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,