Hi Guys..
Below are few ways to call a Form in AX using X++ code.....
Calling a form Using Menuitem.
Hope this helps you guys.......
Below are few ways to call a Form in AX using X++ code.....
Calling a form Using Menuitem.
Args args = new Args();Calling Form Using FormRun.
args.record(myArgumentRecord);
args.caller(this);
new MenuFunction(menuItemOutputStr(MyDisplayMenuItem), MenuItemType::Display).run(args);
static void OpenFormByCodeB()if we change the type of formRun from class FormRun to class Object, we can implement and execute extra methods on our destination form.This helps us to call extra customizations .
{
FormRun formRun;
Args args = new Args();
;
args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
static void OpenFormByCodeB()we can also pass records as parameters in the above code...
{
Object formRun;
Args args = new Args();
;
args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.callyourmethodhere();
formRun.run();
formRun.wait();
}
static void CallLedgerBudgetForm(Args _args)
{
LedgerTable ledgerTable;
BudgetModelId modelId;
Args args;
FormRun formRun;
FormDataSource fds;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
select LedgerTable where LedgerTable.AccountNum == '110110' ;
ModelId= 'SUb1';
args = new Args(formstr("LedgerBudget"));
args.record(LedgerTable);
formRun = classfactory.formRunClass(args);
formRun.init();
fds = formRun.dataSource();
qbds = fds.query().dataSourceTable(tablenum(LedgerBudget));
qbr = qbds.addRange(fieldnum(LedgerBudget,ModelNum));
qbr.value(queryvalue(modelId));
qbr.status(RangeStatus::Hidden);
formRun.run();
formRun.wait();
}
Hope this helps you guys.......
No comments:
Post a Comment