How would it be possible to get the menu item display name from a string? I understand menuitemdisplaystr(class classname) could be used if you explicitly provide the class name. However I am retrieving a list of strings of AOT form names from a sql table and I want to retrieve of the menu display name for these strings. Anyone have a good approach for this?
Do you know what menuitemdisplaystr() returns? A string. Therefore wherever you use a return value of menuitemdisplaystr(), you can use a normal string as well. The purpose of menuitemdisplaystr() is that the compiler verifies that such a menu item exists.
That is not the question, let me simplify my question as I may of made it confusing. I have a string for example “SalesTableListPage” this is the name of the form in the AOT. I want to get the menu display name that links to this form via x++.
Form Name Menu Display Name
SalesTableListPage All Sales Orders <–This is the value I wantto get based off the form name.
This is how you can get the information for all display menu items:
#AOT
#Properties
TreeNode item = TreeNode::findNode(#MenuItemsDisplayPath).AOTfirstChild();
while (item)
{
if (item.AOTgetProperty(#PropertyObjectType) == 'Form'
&& item.AOTgetProperty(#PropertyObject) != '')
{
info(strFmt("%1 - %2",
item.AOTgetProperty(#PropertyObject),
SysLabel::labelId2String(item.AOTgetProperty(#PropertyLabel))));
}
item = item.AOTnextSibling();
}
Every form can be referenced by several menu items or not at all.
Thank you this is what I was looking for.
Is #MenuItemDisplayPath defined already in the system or must it be defined in the code?
It’s already defined in macro library #AOT.