Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

call to the function 'insert' is not allowed inside the call to when it is used as a try function BC SaaS

(0) ShareShare
ReportReport
Posted on by 55

Hello AL Developers,

I am using TryFunction in order to handle standard errors in business central. we usually use Try functions to prevent stopping the job queue functionality. Because, I am doing the insertion in the same function and whenever my code runs its throws error "call to the function 'insert' is not allowed inside the call to when it is used as a try function".

Reason:

From NAV 2017, because changes made to the database by a try function are not rolled back, you should not include database write transactions within a try function. By default, the Microsoft Dynamics NAV Server configuration prevents you from doing this. If a try function contains a database write transaction, a runtime error occurs.

I have find out a solution for NAV because it has been discussed in community but there is no discussion on SaaS business central.

Is there any solution or best way to cater it?

Here is the code,

2273.2022_2D00_06_2D00_22-18_5F00_53_5F00_13_2D00CF25_-Cod50091.EAZYPaymentHandling.al-_2D00_-EAZYPaymentConnect-_2D00_-Visual-Studio-Code.png

  • Shathika Karunaratne Profile Picture
    on at
    RE: call to the function 'insert' is not allowed inside the call to when it is used as a try function BC SaaS

    Hi,

    Try using another separate global procedure with parameters and call the procedure in your TryFunction

  • Marco Mels Profile Picture
    on at
    RE: call to the function 'insert' is not allowed inside the call to when it is used as a try function BC SaaS

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans