This post is machine-translated. The original post in german language can be found here.
These post applies to following versions:
Dynamics AX 2009, Dynamics AX 2012
Dynamics AX 2009, Dynamics AX 2012
|
|
|
|
|
|
This post is machine-translated. The original post in german language can be found here.
These post applies to following versions:
Dynamics AX 2009, Dynamics AX 2012
|
Below you find some examples, how to open a form through code. Each example has it's own Advantages and disadvantages, but i think there is an example available for the most Scenarios.
{
menuFunction menuFunction;
args args;
CustTable custTable = CustTable::find('1101');
args = new args();
args.record(CustTable);
args.formViewOption(FormViewOption::Grid);
menuFunction::runClient(identifierStr(custTable), MenuItemType::Display, false, args);
}
{
FormRun formRun;
args args = new args();
args.name(formstr(CustTable));
args.formViewOption(FormViewOption::Grid);
formRun = classFactory.formRunClass(args);
formRun.run();
formRun.wait();
}
{
FormRun formRun;
args args = new args();
CustTable custTable = custTable::find('250000');
args.name(formstr(CustTable));
args.formViewOption(FormViewOption::Grid);
args.record(custTable);
formRun = classFactory.formRunClass(args);
formRun.run();
formRun.wait();
}
{
SysInfoAction_Formrun SysInfoAction_Formrun;
SysInfoAction_Formrun = SysInfoAction_Formrun::newFormname(formStr(CustTable));
SysInfoAction_Formrun.run();
}
{
SysInfoAction_Formrun SysInfoAction_Formrun;
CustTable custTable = custTable::find('250000');
SysInfoAction_Formrun = SysInfoAction_Formrun::newFormname(formStr(CustTable));
SysInfoAction_Formrun.parmCallerBuffer(custTable);
SysInfoAction_Formrun.run();
}
{
SysInfoAction_FormrunQuery SysInfoAction_FormrunQuery;
Query query;
query = new query();
query.addDataSource(tableNum(CustGroup));
SysQuery::findOrCreateRange( query.dataSourceTable(tableNum(CustGroup)),
fieldNum(CustGroup, CustGroup)).value('D-INL');
SysInfoAction_FormrunQuery = SysInfoAction_FormrunQuery::newFormnameQuery(formStr(CustGroup), query);
SysInfoAction_FormrunQuery.run();
}
{
SysInfoAction_Formrun SysInfoAction_Formrun;
CustTable custTable = custTable::find('250000');
SysInfoAction_Formrun = SysInfoAction_Formrun::newFormname(formStr(CustTable));
SysInfoAction_Formrun.parmCallerBuffer(custTable);
SysInfoAction_Formrun.parmControlname(identifierStr(GridGroup)); // Trick, um im der Rasteransicht zu starten. Das Control GridGroup ist ein Element, in dieser Ansicht
SysInfoAction_Formrun.run();
}
{
SysInfoAction_MenuFunction SysInfoAction_MenuFunction;
SysInfoAction_MenuFunction = SysInfoAction_MenuFunction::newMenuItem(menuItemDisplayStr(CustTable), MenuItemType::Display);
SysInfoAction_MenuFunction.run();
}
{
SysInfoAction_MenuFunction SysInfoAction_MenuFunction;
CustTable custTable = custTable::find('250000');
SysInfoAction_MenuFunction = SysInfoAction_MenuFunction::newMenuItem(menuItemDisplayStr(CustTable), MenuItemType::Display);
SysInfoAction_MenuFunction.parmCallerBuffer(custTable);
SysInfoAction_MenuFunction.run();
}