Skip to main content

Notifications

Business Central forum
Suggested answer

Error API BC : A transaction must be started before changes can be made to the database.

Posted on by 2
Hello,
I'm working on a soap API integration. 
I can easily create a Sales Quote but then I would like to modify it multiple times to add a SQ line each time. First time it seems to work but then I can't either write nor read the SQ. 
 
The returned error is : 
<s:Envelope xmlns:s=/http://schemas.xmlsoap.org/soap/envelope//><s:Body><s:Fault><faultcode xmlns:a=/urn:microsoft-dynamics-schemas/error/>a:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException</faultcode><faultstring xml:lang=/en-US/>A transaction must be started before changes can be made to the database.</faultstring><detail><string xmlns=/http://schemas.microsoft.com/2003/10/Serialization//>
 
Any idea why is that? Do I have to commit the changes I push through API ? How to do so ? 
 
Environment is on premise and Version: BE Business Central 19.5 
 
Thanks
Categories:
  • Suggested answer
    JM Profile Picture
    JM 54 on at
    Error API BC : A transaction must be started before changes can be made to the database.

    Hi there!

    Yun Zhu's answer would be a solution, but since you are running version 19.5 on prem, that shouldn't be affecting you.

    It sounds like you're running into a transaccion issue while trying to modify a Sales Quote multiple times. Here's a quick rundown of what might help:


    • Make suyre each API call starts and commit its own transaction. Business Central usually handles this, but for multiple operations, you might need explicit control.

    • Consider using a Codeunit to manage the transactions. This way you can handle multiple operations into a single transaction.

    •  
    Here's a quick simple example:
     
     
    Hope it helps!
     
    Cheers!
     
    JM
     

     

  • Suggested answer
    CU02050609-0 Profile Picture
    CU02050609-0 8 on at
    Error API BC : A transaction must be started before changes can be made to the database.

    Agreed.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 62,631 Super User on at
    Error API BC : A transaction must be started before changes can be made to the database.

Helpful resources

Quick Links

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284,737 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,254 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans