Wednesday, 14 October 2015

List all the objects on menus (forms/Reports) AX 2009/ 2012

The code below will populate the info of forms,reports etc.. form all the menus created under AOT

static void AllObjects(Args _args)
 {
     Set     set = new Set(Types::String);
     TreeNode  menu, menuOld;
     str     name;
     #Properties
     #AOT
     ;
       menu = new TreeNode();
       
       menu = TreeNode::findNode(#MenusPath).AOTfirstChild();
     
       while(menu)
       {        
         if(menu.AOTname() != 'Methods')
         {          
           menuOld = menu;
           info(menu.treeNodePath());
           menu = menu.AOTfirstChild();
         }         
         else
         {
           menuOld = menu;
           menu = menu.AOTnextSibling();
         }
        
         if(!menu)
         {
           menu = menuOld.AOTnextSibling();
           while(!menu &&(name != 'menus'))
           {
             menu = menuOld.AOTparent();
             menu = menu.AOTnextSibling();
             menuOld = menuOld.AOTparent();
             name = menuOld.AOTname();
           }
         }
       }
 }

2 comments:

  1. Replies
    1. This will list objects by Module and even drill by setup, Reports, Periodic. it's not by role like Account payable manager/ clerk

      Delete