Search This Blog

Saturday, 14 June 2014

Passing Arguments from One Form to Another Form in AX 2012

Hi Guys,

Today I would like to share you how to pass arguments from one form to another form in AX 2012

Create Two New Table and Two New Form

For an example , I have created two new Table and two new Form

Table 1: SheetTable

 

Table 2:SheetDetails



Form 1 :SheetTable , Datasource Name : SheetTable

Create Ok Button in SheeTable Form


Write a piece of logic in the clicked method



void clicked()
{
Args args;
FormRun formRun;
super();
args = new args();
args.parm(SheetTable.SheetId);

args.record(SheetTable);
args.name( formstr( SheetDetails ) );

formRun = classFactory.formRunClass( Args );
formRun.init();
formrun.run();
formrun.wait();

}
Form 2: SheetDetails , DataSource Name : SheetDetails
 
 
write a piece of code in Form level init() method
public void init()
{
Query query;
QueryBuildRange qbr;
SheetTable _sheetTable;
SheetDetails sheetDetails1;
Str _parmid;
super();
_sheetTable = element.args().record();
_parmid= element.args().parm();
query= new Query();
qbr=query.addDataSource(tableNum(SheetDetails)).addRange(fieldNum(SheetDetails,SheetId));
qbr.value(_parmid);
SheetDetails_ds.query(query);
}
 
Output:
That's it ..........We have done it


Happy Daxing........

2 comments: