Monday, August 3, 2020

How to call menuitems from code x++ AX 2012/D365

Calling Display MenuItem:

new MenuFunction(menuItemDisplayStr(MyDisplayMenuItem), MenuItemType::Display).run();

Calling Output MenuItem:

new MenuFunction(menuItemOutputStr(MyOutputMenuItem), MenuItemType::Output).run();
Following code can be used to pass an argument to the menuitem:
Args args = new Args();
args.record(myArgumentRecord);
args.caller(this);
new MenuFunction(menuItemOutputStr(NameOfOutputMenuItem), MenuItemType::Output).run(args);

How to loop selected records on grid for form in dynamics ax?

To loop/iterate selected records from grid on form you can use following code, this can be done on clicked method of button control : Invent...