Published On: October 20, 2016Categories: Technical

The error message “Sales order XX has been updated by another user.” is a standard error message when user tries to update (post document) against a sales order but in the mean time another user already did updated the same order. In general, AX captures the quantities remaining when posting parameter form opens and check if these values are the same when posting executed. In case of a change, the error message appears. This is a safety mechanism that prevents updating the same lines and quantities more times. However this error message can also be a result of customization.
One of my clients asked for a customization in packing slip grouping/splitting. Standard AX offers a setup for this but is some cases this setup does not fit the customer needs. In such a case SalesFormLetterParmData classes need to be customized. I did changed the ParmData class to meet the customer requirements. Everything was working just fine until we got the error message “Sales order XX has been updated by another user.”. At first I thought that multiple users tried to update the same order at the same time since we experienced this in test environment. But very soon I figured out that it was not updated by another user because the order was not updated at all.
Investigating the problem I found out that one sales order line was part of multiple packing slips. This was the origin of the problem. When Packing slip update function called AX creates SalesParmLine records for each SalesLine that need to be updated. Besides other information like ItemId, InventTransId, quantities etc. AX also copies remaining quantities from SalesLine into SalesParmLine table. This information is stored into the following fields:

  • RemainBefore
  • RemainBeforeInvent
  • RemainBeforeInventPhysical
  • RemainAfter
  • RemainAfterInvent

In case when one sales line is split between multiple packing slips that should be posted in one go (same ParmIdI there is an issue. The first packing slip goes well without any issues and this action reduces the Remain fields on SalesLine. When second packing slip goes trough the validation process AX finds out that the Remain values on SalesLine and SalesParmLine differ and “Sales order XX has been updated by another user.” error message appears.
In order to avoid this Remain field on the SalesParmLines need to be maintained. For example, sales line has quantity 10 where 7 goes to first packing slip and 3 goes to second one. The second SalesParmLine record need to have Remain quantities reduced by 7. This way AX will validate that the remain quantity is 3 (which is correct) and will proceed with the posting. The validation for remain quantities is executed twice, once when Parm form displayed and once when user clicks on OK button (when posting trough code or in batch is only once). Before form opening both SalesParmRecords must have the same values because they are compared with the original SalesLine. For the second check, after OK click, we need to udate Remain quantities. This is important because we need to change the values after prompt method on SalesFormLetter class, but before run method.
Another attention point are the units of measurement. The Remain fields that contain “Invent” in the name store quantities in inventory unit while the rest in sales unit. If these are different then inventory unit conversion is needed in order to calculate the inventory remain fields.