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 :
Finance | Project Operations, Human Resources, ...
Answered

Cannot edit a record in Purchase orders (PurchTable). Update must be performed inside a transaction.

(1) ShareShare
ReportReport
Posted on by 1,295

Hello,

I needs help, I am adding up a logic updating a record in the purchTable when I click confirm after the operation is complete it cannot proceed when I use my extension class. Can anyone explain or how is it possible to add a logic once the PO is confirmed? Thank you.

I have the same question (0)
  • Verified answer
    Puneet Darji Profile Picture
    166 on at

    Hi,

    If you are getting the error as you mentioned in subject in that case you need to write your logic between ttsbegin and ttscommit.

  • Navneeth Nagrajan Profile Picture
    2,438 Super User 2025 Season 2 on at

    Hello SII1MNL,

    As per your subject, if that's the error that you are facing then ttsbegin and ttscommit is what you need to write your code in.

    A few questions:
    1. The field that you are trying to update is it a custom field?
    2. Which operation are you referring to? Is it that PO after confirmation needs to update details in the PurchTable?
    3. Once you click the confirm button, your PO needs to be updated?

    If the answer to the third question is yes, then write an event handler on the click event of the Confirm button inside the extension class. 

    Thanks,
    Navneeth Nagrajan | Dynamics 365 Technical Consultant

  • Verified answer
    WillWU Profile Picture
    22,361 on at

    Hi SII1MNL,

    As Puneet said, you should put ttsBegin and ttsCommit.

    Add ttsbegin before query statement,and add ttscommit after the operation

    Just like the following codes:

    static void dodelete(Args _args)
    {
        InventParameters    invent;
          
        ttsBegin;
        select forUpdate invent;  
        invent.doDelete();
        ttsCommit;
        info("Done....");
    }

    Hope this helps.

  • SII1MNL Profile Picture
    1,295 on at

    yes a custom field, nothing mandatory, just getting the Description on PO Line 1st line. if it is blank the it will do nothing if there is , then it will get the description to custom field right after it is confirmed.  

    yes it is number 2.  after confirmed

  • Rahul Mohta Profile Picture
    21,032 on at

    give us more insight as to where the extension code is being written ?

    are you using CoC or something else?

  • WillWU Profile Picture
    22,361 on at

    Hi partner,

    I don't think adding an event handler on the click event of the Confirm button is a good choice,  if the confirmation didn't come in from the button click, it will doesn't work.

    Add post event handlers on the update method of PurchTable,or you can copy the vaild method on PurchFormLetter class

    Please refer to the following article about adding event before confirmation.

    http://asharpx.blogspot.com/2018/01/how-to-check-custom-validation-on.html

  • Suggested answer
    SII1MNL Profile Picture
    1,295 on at

    Thank you I forgot to add ttsbegin and ttscommit , now it is working.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    Will ,

    Overlayering is not allowed since 8.0 so it is not recommended.

    salesConfirmJourCreate  class is used during posting confirmation which creates record in CustConfirmJour  and CustConfirmTrans. You should look at this class instead and do COC on appropriate method which does posting.

  • WillWU Profile Picture
    22,361 on at

    Hi Sukrut,

    Thank you for guidance.

    I'm sorry that my description is not precise.

    I mean copy event handlers on PurchFormLetter, please take a look at my link.

  • Puneet Darji Profile Picture
    166 on at

    Hi,

    Please mark the post as answer if your query is solved.

    Thanks!

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

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans