Showing posts with label Menue items list AX 2012. Show all posts
Showing posts with label Menue items list AX 2012. Show all posts

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();
           }
         }
       }
 }