This post is machine-translated. The original post in german language can be found here.

Searching for menu items name

In Dynamics AX there is no way to search about a menu items name. So i've created a job, which creates the ability to do so.

The job will search about "*debitor*" and returns all found menu items in infolog. Using doubleclick on the entry in infolog will open the form or the equivalent function.

static void findMenuItem()
{
    str _searchStr = "*debitor*";

    TreeNode treeNodeMenuNode;
    TreeNode treeNodeMenu;
    TreeNodeTraverser treeNodeTraverser;
    TreeNode treeNodeMenu4Path;
    Menu menu4Path;
    MenuItem menuItem;
    str 200 path;
    SysInfoAction_MenuFunction sysInfoAction_MenuFunction;
    container menuCon;
    int i;
    #AOT
    #resAppl
    #TreeNodeSysNodeType

    if(_searchStr == "") return;

    setPrefix("Suchergebnisse");

    treeNodeMenuNode = TreeNode::findNode(#MenusPath);
    treeNodeTraverser = new TreeNodeTraverser(treeNodeMenuNode);
    while (treeNodeTraverser.next())
    {
        treeNodeMenu = treeNodeTraverser.currentNode();

        if(treeNodeMenu.treeNodeType().id() == #NT_MENUITEM)
        {
            menuItem = treeNodeMenu;

            if(menuItem.label() like _searchStr)
            {
                sysInfoAction_MenuFunction =
                SysInfoAction_MenuFunction::newMenuItem(
                    menuItem.menuItemName(),
                    menuItem.menuItemType());

                menuCon = str2con(treeNodeMenu.treeNodePath(), "\");

                path = "";
                for (i=3;i                 {
                    if(i==3)
                    {
                        treeNodeMenu4Path =
                        TreeNode::findNode(#MenusPath + "\" +conPeek(menuCon, i));
                        if(treeNodeMenu4Path && treeNodeMenu4Path.treeNodeType().id() == #NT_MENU)
                        {
                            menu4Path = treeNodeMenu4Path;
                            path += menu4Path.label();
                        }
                    }
                    else
                    {
                        path += conPeek(menuCon, i);
                    }
                    path += " > ";
                }

                info(path + menuItem.label(), "", sysInfoAction_MenuFunction);
            }
        }
    }
}
These post applies to following version:
Dynamics AX 2012

Simon Lacher 03/28/2013 12:11 | #1


Simon Lacher 03/28/2013 13:03 | #2


Heinz Schweda 04/16/2013 21:05 | #3


 
 

 

 
 
 
Posts of the actual month
November 2024
MoTuWeThFrSaSu
 123
45678910
11121314151617
18192021222324
252627282930 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.