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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Update Conflict error when updating bulk records in x++

(0) ShareShare
ReportReport
Posted on by 170

Hi everyone, I am facing following error when updating records in bulk :

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

I am using this query in x++ , if you find any mistake , please help me out

           update_recordset tCustTransMe

                    setting 

                SettleAmountCur = tCustTransMe.SettleAmountCur + settlementTracking.Settle_Amount,

                SettleAmountMST = tCustTransMe.SettleAmountMST + settlementTracking.Settle_Amount,

                SettleAmountReporting = tCustTransMe.SettleAmountReporting + settlementTracking.Settle_Amount,

                Closed = settlementTracking.isConsumedInvoice == 1 ? settlementTracking.Settle_TransDate : tCustTrans.Closed,

                LastSettleAccountNum = tF3CustSettleTransactionFIFO.AccountNum,

                LastSettleDate = settlementTracking.Settle_TransDate

                join settlementTracking

                    where

                        settlementTracking.traceid == traceId

                        && settlementTracking.AccountNum == accountNum

                        && settlementTracking.Invoice_RecId == tCustTransMe.RecId

                join tF3CustSettleTransactionFIFO

                    where

                        tF3CustSettleTransactionFIFO.CustTransRecId == tCustTransMe.RecId

                        && tF3CustSettleTransactionFIFO.AccountNum == accountNum

                        && tF3CustSettleTransactionFIFO.TraceId == traceId

                        && (tF3CustSettleTransactionFIFO.AmountCur - tF3CustSettleTransactionFIFO.SettleAmount) >= 0;

                ttscommit;

I have the same question (0)
  • GirishS Profile Picture
    27,829 Moderator on at

    Hi Uzair,

    Try the same using while select with update and let us know the results.

    Thanks,

    Girish S.

  • uzk_dynamics Profile Picture
    170 on at

    Hi , thanks for the response,  I tried , its working fine with select with update , and using reread() on table buffer, but performance issue as data is very huge.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, Can you try adding one more buffer for CustTrans say custTransLocal, join custTransLocal with tCustTransMe using RecId and replace tCustTransMe with custTransLocal to check conditions.

  • uzk_dynamics Profile Picture
    170 on at

    Hi , I have modified query as following but it did not work , please check brother, is it fine

                   update_recordset tCustTransMe

                       setting

                   SettleAmountCur = tCustTransMe.SettleAmountCur + settlementTracking.Settle_Amount,

                   SettleAmountMST =  tCustTransMe.SettleAmountMST + settlementTracking.Settle_Amount,

                   SettleAmountReporting = tCustTransMe.SettleAmountReporting + settlementTracking.Settle_Amount,

                   Closed = settlementTracking.isConsumedInvoice == 1 ? settlementTracking.Settle_TransDate : tCustTrans.Closed,

                   LastSettleAccountNum = tF3CustSettleTransactionFIFO.AccountNum,

                   LastSettleDate = settlementTracking.Settle_TransDate

                   join tCustTransLocal

                       where tCustTransLocal.RecId == tCustTransMe.RecId

                   join settlementTracking

                       where

                           settlementTracking.traceid == traceId

                           && settlementTracking.AccountNum == accountNum

                           && settlementTracking.Invoice_RecId == tCustTransLocal.RecId

                   join tF3CustSettleTransactionFIFO

                       where

                           tF3CustSettleTransactionFIFO.CustTransRecId == tCustTransLocal.RecId

                           && tF3CustSettleTransactionFIFO.AccountNum == accountNum

                           && tF3CustSettleTransactionFIFO.TraceId == traceId

                           && (tF3CustSettleTransactionFIFO.AmountCur - tF3CustSettleTransactionFIFO.SettleAmount) >= 0;

                   ttscommit;

    Thanks

    Regards

    Muhammad Uzair Kamdar |  D365 F&O Technical

  • Verified answer
    @NoMe Profile Picture
    217 on at

    Hi uzair,

    Please use custtrans.skipdatamethod(true) before update record set. Hope it works

    [quote user="Uzair Kamdar"]

    Hi everyone, I am facing following error when updating records in bulk :

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

    I am using this query in x++ , if you find any mistake , please help me out

               update_recordset tCustTransMe

                        setting 

                    SettleAmountCur = tCustTransMe.SettleAmountCur + settlementTracking.Settle_Amount,

                    SettleAmountMST = tCustTransMe.SettleAmountMST + settlementTracking.Settle_Amount,

                    SettleAmountReporting = tCustTransMe.SettleAmountReporting + settlementTracking.Settle_Amount,

                    Closed = settlementTracking.isConsumedInvoice == 1 ? settlementTracking.Settle_TransDate : tCustTrans.Closed,

                    LastSettleAccountNum = tF3CustSettleTransactionFIFO.AccountNum,

                    LastSettleDate = settlementTracking.Settle_TransDate

                    join settlementTracking

                        where

                            settlementTracking.traceid == traceId

                            && settlementTracking.AccountNum == accountNum

                            && settlementTracking.Invoice_RecId == tCustTransMe.RecId

                    join tF3CustSettleTransactionFIFO

                        where

                            tF3CustSettleTransactionFIFO.CustTransRecId == tCustTransMe.RecId

                            && tF3CustSettleTransactionFIFO.AccountNum == accountNum

                            && tF3CustSettleTransactionFIFO.TraceId == traceId

                            && (tF3CustSettleTransactionFIFO.AmountCur - tF3CustSettleTransactionFIFO.SettleAmount) >= 0;

                    ttscommit;

    [/quote]

    Thanks.

  • uzk_dynamics Profile Picture
    170 on at

    Thanks , it worked

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

News and Announcements

Season of Giving Solutions is Here!

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 836 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 452 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 349 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans