Thursday, May 5, 2016

Copy User group Record level security to another user group In AX

static void AXCopyUsergroupRLS(Args _args)
{
    SysRecordLevelSecurity  SysRecordLevelSecurity,insertRLS;
    dialogfield srcdf,destdf;
    dialog dialog;
    userGroupid src,dest;
    ;
    dialog = new dialog("copying user group's Record Level security ");
    srcdf = dialog.addField(typeid(userGroupid),"Source");
    destdf = dialog.addField(typeid(userGroupid),"Destination");

     if(dialog.run())
    {
        src = srcdf.value();
        dest = destdf.value();
        if(src!="" && dest !="")
        {
          ttsbegin;
          info("Copying RLS to destination user group");
          while select * from SysRecordLevelSecurity
            where SysRecordLevelSecurity.groupId == src
            {

            insertRLS.data(SysRecordLevelSecurity);
            insertRLS.groupId = dest;
            insertRLS.insert();

            }
             ttscommit;
            info("User groups RLS has been copied!");
        }
     }
     else
    {
        info("Canceled by user");
    }



}

No comments:

Post a Comment

Sending Email using X++ Code in D365 F&O/ AX 7 in HTML fomat

  I was just researching on the emailing capabilities in D365 and found that SysINetMail, SysMailer and some of the smmOutlook classes are d...