Hi,
I’d appreciate some guidance on this.
We have a requirement to ensure that when a specific TaxGroup is used on the SalesLine, the SalesTable.TaxGroup is kept in sync. We added a COC to the SalesLine update logic. This works in most scenarios.
SalesTable salesTable= this.salesTable(true);
if (salesTable.TaxGroup != this.TaxGroup && salesTable.checkUpdate())
{
ttsbegin;
salesTable.TaxGroup = this.TaxGroup;
salesTable.update();
info("Letting user know about the update");
ttscommit;
}
The problem appears when the address on the header is updated and SalesTable2LineUpdate runs. The call chain becomes:
SalesTable.write() → SalesTable2LineUpdate → SalesLine.update() → our COC
Once this chain finishes, control returns to SalesTable.write(), which then continues updating the SalesTable. Because our COC has already modified the SalesTable, we end up with a conflict error. This is expected behaviour, but still problematic.
My question is:
Is there any reliable way to detect that the SalesTable is already being updated as part of this write method?
SalesTable.checkUpdate() always returns true, so it isn’t helping here.
Or would you use something else to fulfill this requirement?