Skip to content

Passing Multiple Records from one form to another through Args in D365 FO

Requirement : When I select multiple record in Form A, those records will be passed to FormB and there FormB will received the all those records and filter it and will show.

Step 1: Make one EmployeeTable which has three fields named (SrNo, Name, Designation).
Step 2: Make FormA with datasource as EmployeeTable and drag the datasource fields into the design Grid.
Step 3: Drag one button and override the click method and write the following code.
step 4: Make one Display menuitem of FormB.

void clicked()

int recordsCount;
EmployeeTable _employeeTable;
container con;
Args args;
str multiSelectString;

args = new Args();
recordsCount = EmployeeTable_ds.recordsMarked().lastIndex(); // gets the total records selected
_employeeTable = EmployeeTable_ds.getFirst(1);

while (_employeeTable )
// storing recid of selected field in container
con = conIns(con,1,_employeeTable.RecId);

// converting container to string with comma separated
multiSelectString = con2Str(con,’,’);

_employeeTable = EmployeeTable_ds.getNext(); // moves to next record
// passing string
// calling menu item
new MenuFunction(menuitemDisplayStr(FormBMenuItem), MenuItemType::Display).run(args);

Step 5: Make FormB with datasource as same table for which you take for Form A i.e., EmployeeTable and drag the fields in to the
Grid of design part.
Step 6: write the following code in to the init method of FormB.

public void init()
container con;
int i;
str multipleRecords;
// getting string value from caller
multipleRecords = element.args().parm();

// string to container
con = str2con(multipleRecords,”,”);

// for sorting
for(i = 1;i<= conLen(con) ;i++)


Please select button property multiselect to “yes”

Published inForm customization techTechnical Blog