Sample piece of code to open AX form through X++
If you want to pass a record to open a form
static void
OpenForm_ThroughCode(Args _args)
{
Args args;
Object
formRun;
// open form
args = new Args();
args.name(formstr(FormName));
formRun =
classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}If you want to pass a record to open a form
args = new
Args();
args.record(ProjTable::find('PR00001'));
args.name(formstr(FormName));
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
How to retrieve these args
on caller form's init()
{
ProjTable projTableLocal;
super();
projTableLocal
= element.args().record();
}
This comment has been removed by the author.
ReplyDeleteHello,
ReplyDeleteI had used the above code to calling other form from grid. I have grid and open the other form by double clicking on the any grid record. In grid, there are columns ( ServiceID,CustID,CustomerName etc...). My problem is that When I double click on grid, it will open ServiceOrder form(SO NO : So-10001) then again double click on the grid,again open the serviceorder form(SO NO : So-10002). Means two Serviceorder forms will be opened with different SO number like (So-10001 and So-10002) but after that in both ServiceOrder forms, it display the same ServiceId and same details. I don't know why it happend.Can you please guide me? Thanks in advance.