1
votes

When Creating a Shipment via API in Acumatica, I receive the error

Another process has updated 'SOOrder' record. Your changes will be lost

The way we create the Shipment is as follows:

  1. Add the sales order to the shipment.
  2. Save.
  3. Clear the Screen. oScreen.SO302000Clear();
  4. Load the created Shipment.
  5. Add Shipment details such as Bin Locations, ship qtys, Batch/Serials etc.
  6. Save.

The issue happens if the user loads the created shipment in Acumatica right after it has been created. Then, when the API attempts to post the shipment details (Steps 4 to 6), the API throws the error

PX.Data.PXLockViolationException: Error #90: Another process has updated 'SOOrder' record. Your changes will be lost.

Is there anyway we can avoid that Lock Violation Exception when editing a Shipment that is currently opened in the UI?

1

1 Answers

5
votes

Saving a shipment triggers a long-running, asynchronous operation. You need to wait for this process to complete before you do anything else, by calling GetProcessStatus() and retrying until it is completed. Otherwise, you'll run into concurrency issues with your second update call.