Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

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

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,

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

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

    what about on prem 18?

  • BrianDev Profile Picture
    BrianDev 105 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

    Try functions for Saas do not support any type of write transactions.(Insert,Modify,Delete,Rename)

    For on prem solutions you can update the customsSettings.Config to allow this but Microsoft does not recommend this.

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

    Not able to find this yammer community you have shared with me.

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans