7 May 2018

Get List of all menuitems or list of objects from AOT in AX 2012

Before Run the Job, Create Table (Testtable) with fields MenuItemName, menuItemObject (You can extend with Name).

When you run the below Job data will populate in TestTable.

static void ListOfAllMenuitemsinAOT(Args _args)
{
    UtilElements       utilElements;
    UtilEntryLevel    LayerName = UtilEntryLevel::usr;
    TreeNode            treeNode;
    TestTable            testTable;
    #Properties
    #AOT

    delete_from  testTable;

    while select utilElements
        where utilElements.recordType == UtilElementType::ActionTool && utilElements.name like "axl*"
           // && utilElements.utilLevel == LayerName  //for layers filtering
    {
        treeNode = xUtilElements::getNodeInTree(xUtilElements::parentElement(utilElements));

        testTable.MenuItemName = utilElements.name;
        testTable.menuItemObject = treeNode.AOTgetProperty(#PropertyObject);

        if(testTable.menuItemObject != "")
        {
            testTable.insert();
        }
   
    }

}

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...