Dynamics 365 Business Central and TryFunctions: be careful!

Stefano Demiliani

I think that most of you know what Try methods are in the Dynamics Business Central (and Dynamics NAV too) world. Try methods in AL enable you to handle errors that occur in the application during code execution. You can declare a Try method by using the TryFunction attribute as follows:

procedure MyTryFunction()

The official documentation about TryFunctions says the following: because changes made to the database by a try method aren’t rolled back, you shouldn’t include database write transactions within a try method. By default, the Business Central Server configuration prevents you from doing this. If a try method contains a database write transaction, a runtime error occurs.

Generally speaking, you don’t need to perform write transactions inside a TryFunction (for transaction consistency) and normally in the past you will receive an error if you do that. More precisely, for Dynamics 365 Business Central on-premise and for Dynamics…

Ursprünglichen Post anzeigen 455 weitere Wörter





%d Bloggern gefällt das: