If you have tried to use Update_recordset with CrossCompany option you’ll probably have faced this error : “Cannot update multiple records in yourTable(yourTable).
Cross company update_recordset operation should skip database logging.”
The reason is because you have to disable database logging before to proceed
To solve this issue you must use these methods :
yourTable.skipDataMethods(true);
yourTable.skipDatabaseLog(true);
yourTable.skipEvents(true);
Follow this code :
TaxTrans taxTrans;
TaxBook taxBook;
TaxBookSection taxBookSection;
taxBook = TaxBook::findByTaxBookId('ACQCEE');
taxBookSection = TaxBookSection::findByTaxBookSection('ACQCEE');
if(taxBook && taxBookSection)
{
ttsbegin;
taxTrans.skipDataMethods(true); //Use these methods to solve the issue
taxTrans.skipDatabaseLog(true); //Use these methods to solve the issue
taxTrans.skipEvents(true); //Use these methods to solve the issue
update_recordset crossCompany taxTrans
setting TaxBook = taxBook.recId,
TaxBookSection = taxBookSection.RecId
where taxTrans.TaxBook == 0
&& taxTrans.Voucher like 'ACEE21*'
&& TaxTrans.dataAreaId == 'DAT';
ttscommit;
info(strFmt(" %1 rows updated", int2Str(taxTrans.RowCount())));
}
Comments
Post a Comment