here we want to pass the value from the form to class.
if (args.caller() && formHasMethod(args.caller(), identifierstr(M)))
{
formRunObject = args.caller();
{
formRunObject = args.caller();
formRunObject.M();
}
this code does not work in ax 2012 but it works fine in ax 2009.
here we have to create a class , a menu item as action and then call this menu item in form's click method and then pass the value in the class through menu item and catch the vaulue in the main method of class.
First create a form demo form with a table called demo table where we will have only one field over there and one grid in design and one button over there.
then create a class1
create a menu item with action type and assign the class to that.
then write the click method of that button as
void clicked()
{
//super();
MenuFunction mf;
args args = new Args();
;
args.record(DemoTable);
mf = new menufunction(identifierstr(MenuItem1), MenuItemType::Action);
mf.run(args);
}
now open the form and insert a record and click the button you will get output as