web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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 79

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

  • Marco Mels Profile Picture
    Microsoft Employee 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
    6 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,496 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 961 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 870 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans