Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

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

(0) ShareShare
ReportReport
Posted on by

I am using PHP for web services. While requesting for the customer prices page, I am getting following response.

A transaction must be started before changes can be made to the database.

My PHP code as follows

public function getPriceList($customer_number){
    $url = 'Page/CustomerPrices';
    try {
        $response = new \stdClass();
        $response->status = false;
        $options = [
          'soap_version' => SOAP_1_1,
          'connection_timeout' => 120,
          'login' => env('MICROSOFT_DYNAMICS_NAV_USERNAME', ''),
          'password' => env('MICROSOFT_DYNAMICS_NAV_PASSWORD', ''),
          'exceptions' => true,
        ];
        $soapWsdl = env('MICROSOFT_DYNAMICS_NAV_URI', '').$url;
        $client = new SoapClient($soapWsdl, $options);
        $response->data = $client->ReadMultiple(['filter'=> [],'Start_Date' => "30-05-2018",'Cust_No'=>$customer_number,'Name'=>'Testing','Price_Comments'=>'','setSize'=>'1']);
        $response->status = true;

    }catch (SoapFault $e) {
        $response->data = $e->getMessage();
    }
    return $response;
}


*This post is locked for comments

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Error: A transaction must be started before changes can be made to the database.

    Check the triggers on that page. Do you have something that updates the records?

  • Community Member Profile Picture
    on at
    RE: Error: A transaction must be started before changes can be made to the database.

    Yes, it is a customized page.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Error: A transaction must be started before changes can be made to the database.

    This error normally occours when you have placed code on the wrong NAV trigger. Is the CustomerPrices page the standard NAV page or do you have customizations?

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans