Step 1: Make one SampleTable which has three fields named (SIno, name, AddressCity).
Step 2: Make FormA with datasource as SampleTable and drag the datasource fields into the design Grid.
Step 3: Drag one button and override the click method and write the following code.
void clicked()
{
Args args;
FormRun formRun;
;
super();
args = new args(formstr(FormB)); // sending Args(record) to FormB
args.record(SampleTable);
formrun = classfactory.formrunclass(args);
formrun.init();
formrun.run();
formrun.wait();
formrun.detach();
}
step 4: Make FormB with datasource as same table for which you take for Form A i.e., SampleTable and drag the fields in to the
Grid of design part.
step 5: write the following code in to the init method of FormB.
public void init()
{
SampleTable _sampleTable;
super();
_sampleTable = element.args().record();
SampleTable_ds.query().dataSourceTable(Tablenum(SampleTable)).addRange(fieldNum(SampleTbl,RecId)).
value(SysQuery::value(_sampleTable.Recid));
}
Note: You can pass only one Record with this Code, if you want to pass multiple grids,i will cover in next post.
thanks and your feedback will be appreciated.
Thank you very much! Works like a charm
ReplyDeleteThanks it helped me..
ReplyDeleteHI Raziq, in this scnario i can pass the values from Form A to Form B. but how to store the passing values in form B. Can you reply me.
ReplyDeleteThanks Man .. Very Help Full Since I am New Ax ;)
ReplyDeleteGood post
ReplyDelete[…] Reference:http://mfmujahidmim.wordpress.com/2013/03/20/passing-args-from-form-to-form-in-dynamics-ax-2012/ […]
ReplyDelete