AX – D365FO – X++ Code to find all the privileges for a menu item in AX

Create this job to find all the privileges for a menu item

static void findAllThePrivilegeForSpecificMenuItem(Args _args)

{

    SecurityTask                          securityTask;

    SecuritySubTask                    securitySubTask;

    SecurityTaskEntryPoint          securityTaskEntryPoint;

    SecurableObject                    securableObject;

 

    while select * from SecurityTaskEntryPoint

              join    SecurableObject

             where SecurableObject.RecId == SecurityTaskEntryPoint.EntryPoint

              &&    SecurableObject.Name == menuitemOutputStr(TaxReport_IT_ERA) //your menu item


     {

 

              while select * from securityTask

                        where securityTask.RecId == SecurityTaskEntryPoint.SecurityTask

               {

                         info(strFmt("%1,%2,%3,%4", securityTask.AOTNAME, securityTask.Name,securityTask.Type,securityTaskEntryPoint.PermissionGroup));

                }

       }

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s