Hello,
I had a business requirement where I had to create packing structures against purchase orders at time of packing of containers. I have achieved the entire solution except that there is one major issue. For the automation I have used the Enqueue API to import XML based files into Dynamics Inbound ASN V3 entity.
There is a recurring data job that has its recurrence set to 1 minute that communicates with the enqueue API to import that file. The issue arrives when I try to enqueue multiple files at once. Like say I have enqueued 4 files with a gap of about 30 to 50 seconds. Once the import starts via the integration, randomly out of nowhere either the second or the third or the fourth file enqueued to the API fails to import into Dynamics. Upon my investigation what happens is that when the first file comes in to the entity it inserts fine but since the record has been updated/changed in terms of dynamics the next file coming in might throw an error stating
"Cannot edit a record in Purchase Order Additional Fields (WHSPurchLine).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record."
Here's a screenshot showing the Inbound ASN V3_WHSInboundLoadPackingStructureLineV3Entity logs:
I tried the import with setting the recurrence to 3 minutes but what it did was out of the 5 files i tried importing, Dynamics threw an error on the 2nd, 3rd and 4th files and successfully imported the 1st and 5th files.
Can someone kindly shed some light onto this on how can I achieve this solution?
Hi Judy,
Thank you very much for your response.
The thing is that the enqueue API queues up the file one by one as the end user is performing the steps of the process. The enqueue API would only return a response Id and the data recurring job once runs it picks up every file that exists in the queue and starts to process them all at once. I traced the error down at the code level and it is raised at WHSPurchLine update method on the call to Super with the following error message:
Microsoft.Dynamics.Ax.Xpp.UpdateConflictException: 'Cannot edit a record in Purchase Order Additional Fields (WHSPurchLine).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.'
I'm thinking of a way to either make the enqueue API only pick one file at a time, process it and then pick the next file. But I'm not sure how I could achieve this.
Hi Taha,
When you set up a data project and recurring data jobs, you can Create a data project > Create a recurring data job > Authorization for the Recurring Integration API > Queue the recurring Import Job. you said u have enqueued 4 files with a gap of about 30 to 50 seconds. I think you could add a response value and only do the second file if the first one succeeds and returns, which would avoid a lot of errors.
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156