How to Call a Run base class from a Menu item in AOT?

Hello I have create a run base class which gives the following output!


Now I want to call this class using a Menu Item Button from a form… I have dragged the Class into the Action part of the Menuitems… I have created a menuitem button in the design part of form and opened a method called clicked… I am stuck here… how can i called the Class using this method Clicked? Or is there a better way to do so?

Here is the drop down of the form!



1.There are two ways to do this :


static void OpenDisplayMenuItem()


Args args = new Args();



new MenuFunction(MenuItemDisplayStr(VendTable),MenuItemType::Display).run(Args);



static void OpenForm()


FormRun formRun;

Args args = new Args();



formRun = ClassFactory.formRunClass(args);




In case of any issue do let me know :slight_smile:



No, both suggestions are wrong. There is no need to write any code to open a form by menu item. But above all, the question is about executing a RunBase class, not about a form.

@Chitanya, your problem is not primarily about RunBase classes, the problem is that you don’t know how menu items work in general.

If you use a menu item pointing to a class, AX executes its main(Args _args) method (or throw an error if it doesn’t exist). You have to implement your code in the main() method.

The usual implementation looks like this:

public static void main(Args _args)
    RunBase runBase = new MyClassExtendingRunBase();
    if (runBase.prompt())

As you see, you don’t need any clicked() method in your form. As soon as you implement the class correctly, you can drag & drop the menu item to forms and it all works.

Thanks Martin,

That worked!This is the first time i am working with classes and menu items so i got the concept wrong… thanks for helping me out! I got the Main method right but messed up at the properties in the menu items… Thanks anyways


Thanks for the Reply Pawan!