web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get the name of form from menu Item?

(0) ShareShare
ReportReport
Posted on by 932

Hi,

I have privilege,I want to get from this privilege the name of menu Item in entry point and the form :

for the menu Item I develop this instruction:

//get the entry point from privilege:

 treeNode = TreeNode::findNode(#SecPrivilegesPath + #doubleAntiSlash + conPeek(privilegesCont, i) + #doubleAntiSlash + #EntryPoints);

 node = TreeNode.AOTfirstChild();

while (node)
{
 select  eukSecurityMenuItem where eukSecurityMenuItem.SecurableName == node.AOTgetProperty(#ObjectName);

}

I want to add the name of form from this menu Item :

2021.item.png

*This post is locked for comments

I have the same question (0)
  • AXTechie2120 Profile Picture
    568 on at

    Hi,

    You want to call the menuitem name in your code. Am i Right?

  • BASMA Profile Picture
    932 on at

    no,

    I have privilege ,I want to browse the menu items to get the name of menu Items which is set in this privilege.

    I want alse to know the form that opend this menu item?

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi BASMA!

    Try this:

    TreeNode root = TreeNode::findNode(#MenuItemsDisplayPath + "\\SalesTable");
        
    info(root.AOTgetProperty('Object'));

    You can set your menuItem name instead of SalesTable

  • AXTechie2120 Profile Picture
    568 on at

    hi Basma,

    static void searchSubNodes(Args _args)

    {

     str         treeNodeNames;

     void searchSubNodes (TreeNode _treeNode)

     {

         if (!_treeNode)

             return;

         _treeNode = _treeNode.AOTfirstChild();

         while (_treeNode)

         {

             if (_treeNode.AOTfirstChild())

             {

                 searchSubNodes(_treeNode);

             }

             if (_treeNode.applObjectType())

             {

                 treeNodeNames += strfmt("%1 %2\n", _treeNode.treeNodeName(),_treeNode.AOTgetProperty('ObjectType'));

             }

             _treeNode = _treeNode.AOTnextSibling();

         }

     }

     ;

     searchSubNodes (TreeNode::findNode(@"\Menu Items"));

     info(treeNodeNames);

    }

    Try this and let me know if it works!

  • BASMA Profile Picture
    932 on at

    Thanks for your reply, but I want to search menu item not only in display path but also in action and output

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    You can check AOTgetProperty('ObjectType') and then use needed menu items path.

  • BASMA Profile Picture
    932 on at

    I dont understand your suggestion :

    root = TreeNode::findNode(@"\Menu Items"+"COSJournalTableCost"); i try this instruction but I get error:object not initialized

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    You can try to find object in different path:

        #AOT
         
        str find = "SalesTable";
        TreeNode menuItemFinded;
     
        menuItemFinded = TreeNode::findNode(#MenuItemsDisplayPath + "\\" + find);
            
        if (menuItemFinded)
           info(strFmt("Found menuitem %1", menuItemFinded.AOTgetProperty('Object')));
        else
        {
            menuItemFinded = TreeNode::findNode(#MenuItemsActionPath + "\\" + find);
            
            if (menuItemFinded)
                info(strFmt("Found menuitem %1", menuItemFinded.AOTgetProperty('Object')));    
            else
            {
                menuItemFinded = TreeNode::findNode(#MenuItemsOutputPath + "\\" + find);   
                info(strFmt("Found menuitem %1", menuItemFinded.AOTgetProperty('Object')));
            }
        }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans