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, ...
Unanswered

"An unbalanced X++ TTSBEGIN/TTSCOMMIT pair has been detected" Error

(0) ShareShare
ReportReport
Posted on by 225

Hello,

I am facing one issue on writing logic on save on Purchase Order.

I have used onWritten event of PurchTable & PurchLine datasource to perform logic on save. I want to display one dialog on save with Yes & No buttons. on Yes it will open one URL in new tab on No it will close that dialog.

I am getting "An unbalanced X++ TTSBEGIN/TTSCOMMIT pair has been detected" Error as shown in below screenshot on clicking Yes/No if I had clicked Save without changing any field value of Purchase Order.

pastedimage1612963515880v1.png

If I change any field value and then click on Save then it is working properly.

I have not used any TTSBEGIN or TTSCOMMIT in my code. so there is no chance of missing TTSCOMMIT statement. I have also tried running job with  ttsAbort; statement as suggested in many threads but still getting this error.

I am getting TTS Level = 1 if I click Save without changing any field value. and TTS Level = 0 if I click Save after changing any field value. below is my sample code. so issue start from first line no matter if I write logic to display dialog or not.

pastedimage1612963793062v2.png

I have the same question (0)
  • ergun sahin Profile Picture
    8,826 Moderator on at

    Comment the dialog part (you cant use dialog in tts so first make sure its not the problem creator). If codes run perfectly you can give up that and try a diffirent aproach

  • Pratik Rami Profile Picture
    225 on at

    Hello Ergun Sahin,

    I have removed that dialog code as you can see in my code sample screenshot above. On the very first line of OnWritten event you will get TTS Level = 1, if you have clicked on save without changing any field value. 

  • ergun sahin Profile Picture
    8,826 Moderator on at

    Do you keep getting errors even though there is no dialogue?

    Did you make a full build?

    Do you keep getting errors when you remove your class completely and try?

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Pratik,

    Is this on your Dev environment? Can you try restarting the AOS service to check if the issue persists?

  • Pratik Rami Profile Picture
    225 on at

    Hi Gunjan,

    I am using VHD for Development. After restarting still getting issue

  • Pratik Rami Profile Picture
    225 on at

    hi Ergun Sahin,

    As I have already mentioned I have removed dialog code. still on the first line of onWritten event handler I am getting TTS Level =1. which I think should be 0.

    My point is all TTS should be completed before flow comes in OnWritten event handler.

    After removing my class how I will be able to test ? At least I need that Info statement to test this case.

  • ergun sahin Profile Picture
    8,826 Moderator on at

    Dont pay attention to the tts level. The important thing is whether to get an error or not

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Pratik,

    Is there any other event handler/ CoC method that could be causing the issue?

  • Pratik Rami Profile Picture
    225 on at

    Ergun Sahin,

    till tts Level will be 1 in this block (OnWritten event handler method), I will get that error in dialog. so I want to know why it is  1 ?

    and why it is 0 when you click on save after editing any field value. what is the connection with changing field value and saving record ? in both the case tts should work same I think.

  • Pratik Rami Profile Picture
    225 on at

    Gunjan,

    Same happens in CustTable ( for customer record) Onwritten event handler too.

    In Vendtable, VendInvoiceInfoTable this thing is working fine. no issue there.

    If possible can you write my sample code(screeenshot above) in your environment and check what TTS Level you get when flow comes in event handler

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 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans