Tuesday, May 24, 2016

Copy Usergroup Record level security By table

static void AXCopyUsergroupRLSBytable(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");
            select * from SysRecordLevelSecurity
            where SysRecordLevelSecurity.groupId == src
            && SysRecordLevelSecurity.tabId == 40017;//PAYFGOSIItemCodeInfo table id
            {

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

            insertRLS.insert();

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



}

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

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...