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 :
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

I have the same question (0)
  • Marco Mels Profile Picture
    on at

    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.

  • Shathika Karunaratne Profile Picture
    on at

    Hi,

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

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans