Get Privileges from AOT Tree - D365 - AX 2012 - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Breaking

Friday, November 22, 2019

Get Privileges from AOT Tree - D365 - AX 2012

Get Privileges from AOT Tree X++ / D365

Song Nghia - Technical Consultant

class SCA_GetPrivileges

{     

    /// 
    /// Runs the class with the specified arguments.
    /// 
    /// The specified arguments.

    public static void main(Args _args)

    {

        #AOT

        str find        = "PurchReqTable";

        TreeNode root   = TreeNode::findNode(#SecPrivilegesPath);

        TreeNode            current;

        TreeNodeTraverser   trav = new TreeNodeTraverser(root,false);


        current = trav.next();

        while (current)
        {

            if ((current.AOTgetProperty('ObjectType') == "Form") && (current.AOTgetProperty('Object') == find))

                info(strFmt("Found menuitem %1",current.AOTname()));

            current = trav.next();
        }
    }
}