Perfil de Santosh KumarSantosh Kumar Paruvella'...BlogListasLibro de visitasMás ![]() | Ayuda |
|
|
09 marzo Creation of MenuItem using X++ codeAfter a long break, again I Started my blogging
Here you can find the sample code for, creation of new Menu Item using X++ code.
static void CreateMenuItem(Args _args)
{ #AOT TreeNode treeMenuItem; TreeNode treeDisplayMenu; TreeNode treeMenus; TreeNode treeMenu; str myProp; ; treeMenuItem = TreeNode::findNode(#MenuItemsDisplayPath); treeDisplaymenu = TreeNode::findNode(#MenuItemsDisplayPath + "\\" + "SalesTable"); myProp = treeDisplaymenu.AOTgetProperties(); if (treeDisplayMenu) { treeMenuItem.AOTadd('MySALESTABLE'); treeDisplayMenu = treeMenuItem.AOTfindChild('MySALESTABLE'); myProp = "PROPERTIES\n Object #" + 'SALESTABLE' + "\n Label #" + 'MySalesTable' + "\n ENDPROPERTIES\n"; treeDisPlayMenu.AOTsetProperties(myProp); //treeDisPlayMenu.AOTsetProperties("PROPERTIES\n Object #" + 'SALESTABLE' + "\n Label #" + 'SALESTABLES' + "\n ENDPROPERTIES\n");
treeDisplayMenu.AOTsave(); } } Suggestion: we can set the properties one by one also like the following:
myProp = setProperty(myProp,'Name','MyNewMenuItem');
myProp = setProperty(myProp,'Label','MyNewMenuItem'); treeDisPlayMenu.AOTsetProperties(myProp);
Here first we will change the Property Name and we will chnage another property Label
This will be useful, when do u want copy the properties of existing item to newly created items using X++.
|
|
|