web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Cannot call NEXT, update() or delete() on buffer where data is selected or inserted in another transaction scope

(0) ShareShare
ReportReport
Posted on by 2,007

We are experiencing a strange error when attempting to call the updateReservation() method of an InventMovement object. If the item that is in the InventMovement object has an OnOrder quantity in the InventSum table, we receive the following error:

Cannot edit a record in Order Lines (SalesLine). Cannot call NEXT, update() or delete() on buffer where data is selected or inserted in another transaction scope.

It turns out that the InventUpd_Reservation.updateNow() method is not called unless the item is OnOrder. However, after checking the calling class, which is a custom class I created, I do not see anywhere else that we access that SalesLine in any transaction scope. The InventMov_Sales object is not created until right before we call the updateReservation() method and the InventUpd_Reservation object is passed the existing InventMov_Sales object via the InventUpd_Reservation::newMovement() static method. I thought perhaps that InventUpd_Reservation was creating a new InventMovement object, thus causing the error, but it doesn't--it uses the same one.

Does anyone have any idea why this might be happening?

Brandt

*This post is locked for comments

I have the same question (0)
  • Klaas Deforche Profile Picture
    2,433 on at

    This blog post might help:

    community.dynamics.com/.../ax-support-for-pessimistic-locking.aspx

  • Brandt Fundak Profile Picture
    2,007 on at

    Unfortunately, I went back through the stack trace and at no point is a pessimistic lock set. Our global settings are set to use Optimistic locking per table and the SalesLine table is set to use the optimistic lock. At no point in the code that I can see is this overridden. Thank you for your reply however.

  • Klaas Deforche Profile Picture
    2,433 on at

    Can you share the code that throws that error? What happens if you reselect that record before you update it? Or is that not feasible?

  • Klaas Deforche Profile Picture
    2,433 on at

    Also check this:

    gatesasbait.wordpress.com/.../table-caching-and-record-deleteupdatenext

    It could be due to caching (salesline is set to NotInTTS by default)..

    Do you have code anywhere where the transaction is begun after the record has been selected forupdate?

  • Community Member Profile Picture
    on at

    Hi Brandt Fundak

    There might be data that is being update or delete which belongs to other legal Entity (Company). So, get into that method to see what data is being Updated (Update, Deleted). 

    Regards.

    Kumar

  • Community Member Profile Picture
    on at

    Hi
    I do not know if this has been solved already but we got the same error and the solution was to change the transaction scope.

    Does not work and error is created:

    select forupdate * from sysPersonalization where sysPersonalization.UserId == userInfoId;

    if(sysPersonalization)
    {

    perm.assert();
    ttsBegin;
    sysPersonalization.delete();
    ttsCommit;
    CodeAccessPermission::revertAssert();
    }

    Does work an no error is created:

    ttsBegin;
    select forupdate * from sysPersonalization where sysPersonalization.UserId == userInfoId;
    if(sysPersonalization)
    {
    perm.assert();
    sysPersonalization.delete();
    CodeAccessPermission::revertAssert();
    }
    ttsCommit;

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans