Wednesday, May 22, 2013

Get select records by MultiSelectionHelper class

Sometime we have a scenario where we want all/selected records to get to perform certain operation. In Dynamics AX 2012, we can achieve this functionality by the help of MultiSelectionHelper class. Suppose we have a form with Grid multi select property = TRUE, here is the piece of code we should write to get selected record:

void clicked()
{
    CustPaymModeTable custPaymModeTablelocal;
    MultiSelectionHelper helper = MultiSelectionHelper::construct();

    helper.parmDatasource(custPaymModeTable_ds);
    custPaymModeTablelocal = helper.getFirst();
   
    while (custPaymModeTablelocal.RecId != 0)
    {
        info(custPaymModeTablelocal.PaymMode);

        custPaymModeTablelocal = helper.getNext();
    }
}


Happy DAXing !!!!!!

No comments: