Skip to content

Passing Args from one Form to another Form in D365 FO

Args concept in dynamics ax is awesome. one can easily pass arguments from one Form to another Form with very less effort. Here, i am going to demonstrate how to pass Arguments from Form to Form. The Scenario is when I select one grid in Form A, that record will be passed to Form B and there Form B will received the whole record and filter it and will show.

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;
args = new args(formstr(FormB)); // sending Args(record) to FormB
formrun = classfactory.formrunclass(args);

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;
_sampleTable = element.args().record();

Using above code u can pass only one record at a time for multiple record you can try below code.

Published inForm customization techTechnical Blog