From July 9th till 13th we will be at #MSInspire. See you there!

Dynamics AX 2012 Tips And Tricks : Calling MenuItem through Code in Dynamics AX 2012

Dynamics AX 2012 Tips And Tricks : Calling MenuItem through Code in Dynamics AX 2012
14 Mar 2014

Calling MenuItem through Code in Dynamics AX 2012 Tips and Tricks

We often need to execute menu items from X+. Menu Items are represented by the MenuFunction class. Below is a code sample that depicts how to run Menu Items through code.

MenuFunction menuFunction = new MenuFunction(menuitemdisplaystr(MENUITEM), MenuItemType::Display);
Args args = new Args();


Of course the code above may be changed to execute different kinds of Menu Items, for example, the code below runs an Output Menu Item:
MenuFunction menuFunction;

menuFunction = new MenuFunction(menuItemOutputStr(MENUITEM), MenuItemType::Output);;

You should always use functions to get the name of the menu item instead of using a hardcoded string. This insures that in the event that somebody changes the name of the menu item, your code stops compiling and you can fix it.

Below are three functions that are most commonly used to get the Menu Items’ name. Their names are pretty straightforward:



ABOUT Folio3 Dynamics Services

As Dynamics AX experts we specialize in Dynamics AX development including Dynamics AX customization, integration, implementation and mobility solutions. If you have a Dynamics AX development requirement you would like to discuss or would like to know more about our Dynamics AX development services, please get in touch with us.


Raza Rabbani

Latest From Our Blog
7 Ways Dynamics 365 Finance and Operations Boos...
dynamics 365 finance
November 9, 2018
Introduction Launched by Microsoft, Dynamics 365 ERP is one of the most effective for businesses today. It is perfect to save the time, effort and ...
Read more
The Ultimate Guide to Dynamics 365 HR Payroll P...
dynamics hr payroll
October 30, 2018
For any business, irrespective of its size, payroll processing is one of the most important functions. Payroll processing is a method through which...
Read more
An Ultimate Guide to Dynamics 365 Business Cent...
microsoft dynamics business central
September 24, 2018
Microsoft Dynamics Business Central can capably support all your financial processes, whereby enabling smooth integration with supply chain, operat...
Read more
Contact Form