Thursday, October 22, 2009

Running a class from AOT or "How to assign a class to an action menu item?"

OK, so this might seem as a very simple question for many of you.

But, in reality, I still now and then meet people who have worked with AX for quite some time, but don't know this very basic concept.

Therefore, I just want to briefly describe it here to refresh everyone's memory

Apart from allowing to run the class from AOT, this will allow to assign it to a menu item (according to Best Practices, it should be a menu item of type Action), and run the class using this menu item.

Below is the correct syntax of the main method:

public static void main(Args _args)
//Your code here

Please also note, that there is an editor script that contains the template for the main method. You can invoke it from Scripts->template->method->main