AX – D365FO – Loop through selected records of a grid with MultiSelectionHelper class #d365fo #ax #msdyn365fo

If a grid has Multselection property enabled you can select more than a record.

If you want to programmatically loop through selected record just follow this code using MultiSelectionHelper class

void clicked() 
{ 
   InventItemGroup itemGroup; 
   MultiSelectionHelper helper = MultiSelectionHelper::construct();

   helper.parmDatasource(InventItemGroup_DS);

   itemGroup = helper.getFirst();
   while (itemGroup.RecId != 0)
   {
       info(itemGroup.ItemGroupId);

       itemGroup = helper.getNext();
   } 
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s