In this post, i will demonstrate on how to pass Args from Form to Class in Dynamics Ax.
This post will helpful for those who are keen to learn about Args which is very much fruitful concept in Dynamics Ax.
The Scenario is when I select multiple grids in Form , those records will be passed to Class and once you received those records in Class and you can use it as per your Requirement.
Firstly, make one form from which you will pass the arguments and drag your table to the datasource, then drag the fields to the grid of design node, also drag one button adn override the clicked method.
write the following code in clicked method.
args = new Args();
recordsCount = SampleTbl_ds.recordsMarked().lastIndex(); // gets the total records selected
_SampleTbl = SampleTbl_ds.getFirst(1);
// storing recid of selected field in container
con = conIns(con,1,_SampleTbl.RecId);
// converting container to string with comma separated
multiSelectString = con2Str(con,’,’);
_SampleTbl = SampleTbl_ds.getNext(); // moves to next record
// passing string
// calling menu item
new MenuFunction(identifierstr(SampleTest), MenuItemType::Action).run(args);
make one class and write the following code in main method of it.
public static void main(Args args)
multipleRecords = args.parm();
// i am just here an infolog of recids but you can do as per requirement once you got multiple records
thanks and your feedback will be appreciated