To reviewAX 2012

Loop over the selected records of a form with MultiSelectionHelper

Iterate the records a user selected in a grid with MultiSelectionHelper, from a form or from a class called by a menu item.

Written for AX 2012; check MultiSelectionHelper on D365FO.

First written
Re-read
Versions
AX 2012

When an action must run on every record the user marked in a grid, MultiSelectionHelper walks the selection for you.

The original note

The code is shown as published: note that the loop condition tests transFilm, while the records are read into record.

MultiSelectionHelper helper;
;
helper = MultiSelectionHelper::construct();
helper.parmDatasource(_formDataSource);
record = helper.getFirst();
while (transFilm.RecId != 0)
{
    /*Do something*/
    record = helper.getNext();
}

References

  • No Microsoft Learn page was found for MultiSelectionHelper.