Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Enqueue API import error

(0) ShareShare
ReportReport
Posted on by 5

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:

7317.pastedimage1677421520427v1.png

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?

  • Taha Siddiqi Profile Picture
    Taha Siddiqi 5 on at
    RE: Enqueue API import error

    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.

  • Suggested answer
    huijij Profile Picture
    huijij 19,811 on at
    RE: Enqueue API import error

    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. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans