RecordInsertList.add Method [AX 2012]
Adds a record to a RecordInsertList object for subsequent insertion into the database.
public int add(Common record)
Run On
CalledParameters
- record
- Type: Common Table
A database buffer of the same type with which the class is instantiated.
Return Value
Type: intAn integer that indicates whether the record has been successfully added to the list.
The following example uses RecordInsertList to copy a bill of materials (BOM) from one BOM to another. The add method is used to add all the records in the BOM to the RecordInsertList 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: