Take any sales order with a line that has fields SalesLine.Name
and SalesLine.ExternalItemId
populated.
Then run following job trying to modify any field not related to the two above:
SalesLine sl = SalesLine::findInventTransId('US01-000025', true);
ttsBegin;
sl.CustomerLineNum = 100; //any other field will serve as well
sl.modifiedField(fieldNum(SalesLine, CustomerLineNum)); //causes the issue
sl.update();
ttsCommit;
When the job has completed, both Name
and ExternalItemId
will be reset.
The issue is caused by line this.axInventDim().isFieldSet(fieldNum(InventDim, ConfigId))
in \Classes\AxSalesLine\isCustExternalItemDescriptionFieldsSet
, which always returns true
.
As a result, methods AxSalesLine.setName
and AxSalesLine.setExternalItemId
populate respective fields with default values.
Any advice on the reason it has been coded in Microsoft this way, and the best way to fix this?
P.S. I narrowed down the issue to method \Classes\AxSalesLine\setRetailVariantId
that was introduced in R2 CU7