[ ax2012 ] cancel Delivery Order


Cannot edit a record in Sales order - update table (SalesParmTable).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.

This is because Ax throws the exception in /Classes/FormletterService/method/run


and the system have a code between `try` and `setPrefix` to retry again within the `#RetryNum` times.



before throws `Exception::UpdateConflict`.

Real error

If we commented out the Exception::UpdateConflict block, we will see the real exception in \Classes\InventModelType_MovingAverage\checkInventOnHand

The inventory value of 102,476.71 is not expected after the proportional expense calculation. The expected value is 85,397.25.


It is because of the Ax getExpectedCost from cache ( InventModelType_MovingAverage.getExpectedCost(inventSum) ).
The cache was set in the cancel process in /Classes/InventModelType_MovingAverage/setExpectedCost.

When we post cancel delivery in \Classes\InventModelType_MovingAverage\setExpectedCost. If _inventTrans.DatePhysical >= systemDateGet(), then the expected cost will be set. This _inventSum.PhysicalValue is not include the price of the item in this DO.

After that, /Classes/InventModelType_MovingAverage/getExpectedCost will get from cache. Because the _inventSum.PhysicalValue that we set earlier did not include the price of the item in this DO, the validation is fail.

However, if it is ( _inventTrans.DatePhysical < systemDateGet() ), the cache is not set.

Therefore, the /Classes/InventModelType_MovingAverage/getExpectedCost get another _inventSum.PhysicalValue that include the price of item in this DO, so the validation is passed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s