RecordInsertList.insertDatabase Method [AX 2012]
Inserts all records, that have not already been inserted, in the current RecordInsertList object.
The following example uses the RecordInsertList class to copy a bill of materials (BOM) from one BOM to another. The RecordInsertList.add method is used to add all the records in the BOM to the RecordInsertList class before a final call is made to the insertDatabase method to insert all remaining records.
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();
}
Community Additions
ADD
Show: