Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Update conflict

Posted on by 1,289

Hi,

A purchase order has more than 200 purch lines.

I try to change purchline #172, the change happens and after that when I try to go to next purchline or close the form or try to do any other transaction, the system throws an error

Cannot edit a record in Purchase orders (PurchTable).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.

and then we have to exit from the Purchase order form and the purchline # 172 change goes off.

 

Could someone help me in sorting this issue

Also Could some one please tell me when the cursor moves from one line to next, what methods does system run behind, so that I can keep a debugger in those methods and find out where the error is popping up?

Thanks,

Lakshmi

 

*This post is locked for comments

  • vinod777 Profile Picture
    vinod777 35 on at
    RE: Update conflict

    Hi lakshmi,

    Are u able to resolve this issue. I am getting same issue when trying to update qty or price for confirmed po with open status.

    Could you please share if u able to resolved your issue.

  • Lakshmi Karambakkam Profile Picture
    Lakshmi Karambakkam 1,289 on at
    RE: Update conflict

    Hi ,

    to analyze further about this update conflict, I copied the purchtable data in to two different table buffers (before and after).

    Could some please tell me how to find out the data difference in these table buffers using x++ code?

    Thanks,

    Lakshmi

  • Lakshmi Karambakkam Profile Picture
    Lakshmi Karambakkam 1,289 on at
    RE: Update conflict

    Hi Martin,

    The update conflict is happening in kernel phase and is happening because purchtable.ismodified value is turning to NO which should not happen. How to find out why suddenly this field alone is changing?

    Thanks,

    lakshmi

  • Lakshmi Karambakkam Profile Picture
    Lakshmi Karambakkam 1,289 on at
    RE: Update conflict

    Hi,

    The PO which I am referring is an open order with confirmed status.

    The issue is when I am trying to change qty in this particular purchase order, the update is not happening and also system is throwing the update conflict error.

    When a qty in a confirmed PO is changed, the system will change the approval status from Confirmed to Approved and in this process, update conflict error is thrown, as system is not able to archivePurchtable i.e. create a record in purchtablehistory table as the purchtable.ismodified is NO.Purchase-order-update.png

    I debug the entire code and here I found where the strange thing happens but not sure why it happens only in this particular PO.

    Purchase-order-update.png

    when the cursor hits the above update_recordset code, the system is executing all the purchlinetype class methods  and purchtable.ismodified field is set to Yes.

    But when the cursor comes back to the above code, purchtable.ismodified is going back to No when the cursor is back to the main code.

    So it is not able to archivePurchTable i.e. not able to create a record but later trying to update an uncreated record and throwing the error.

    Any idea when such scenario can occur.

    Thanks,

    Lakshmi

     

  • Suggested answer
    5400 Profile Picture
    5400 7,160 on at
    RE: Update conflict

    If you don't have any customization, It looks me standard issue. So you can debug as below flow..

    when you are moving from one row to another row if it is new record without save

    leave records also.

    1. Write

    2. validate write

    PurchtableType (class)-Insert

    3. Insert

    4. kernel

    If it is  existing record and you are updating

    1. Write

    2. Validate Write

    PurchtableType (class)-Update - you can try with reread() function to overcome the scenario before update call. It should work. It is workaround.

    3. Update

    4. kernel

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: Update conflict

    I was just explaining conflict detection in this thread: RecVersion in PurchTable.

    When you switch to another record, the record is saved. The form first calls write() on the datasource, which calls update() on the table. super() in update() calls the kernel logic for saving, which then check if there aren't update conflicts.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update conflict

    you can also try  , close everything, Go to the AOT > restore your Form and table, try is again .  

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update conflict

    what's the status of your purch Order / lines ??

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans