Friday 7 October 2016

RecordInsertList class in AX.


This class allows you to insert more than one record into the database at a time,
which reduces communication between the application and the database.

------------------------------------------------------------------------------------------------

void copyBOM(BOMId _FromBOM, BOMId _ToBOM)
{
    RecordInsertList BOMList;
    BOM BOM, newBOM;

    BOMList = new RecordInsertList(tableNum(BOM));

    While select BOM
             where BOM.BOMId == _FromBOM
    {
            newBOM.data(BOM);
            newBOM.BOMId = _ToBOM;
           BOMList.add(newBOM);
    }

    BOMList.insertDatabase();
}

No comments:

Post a Comment