How to: Access a Class from a Menu
Dynamics AX 2009
You can access a class from a menu by using an action menu item and a static main method.
-
Add a static main method to a class in the Application Object Tree (AOT).
-
Add the code you want to run, to the main method.
In the following example, the main method displays a message on the screen using the print function.
static void main(Args args) { print "Hello World"; pause; }In the following example, the main method calls a class method that prints telephone numbers.
static void main(Args args) { TelNumber telNumber; telNumber = new telNumber(); telNumber.printTel(); }For more information about the print function, see Print Statements.
-
Create an action menu item that references the class you created in step 1. For more information, see How to: Create Menus and Menu Items.
Community Additions
ADD
Show: