insert_recordset doesn’t take the value of TableId from the value
Today, I have observed a very strange thing in AX.
I had to do a bulk insert from some other table where I also need to copy the tableId from the other table.
I have found a strange issue i.e.,everything was getting copied except the tableId. You can try this in a job.
insert_recordset TestTable1(RefRecId, RefTableId) select recId, TableId from TestTable2;
So, the tableid from some other table cannot be used in Insert_recordSet. Atlast, I had to use RecordInsertList class to insert the bulk data.
You could insert from a variable (at least in later versions of AX).
int tab2 = tableNum(TestTable2);
insert_recordset TestTable1(RefRecId, RefTableId) select recId, tab2 from TestTable2