Skip to content
Stefan Maroń edited this page Feb 12, 2024 · 1 revision

Do not call any database operations in TryFunctions.

Database write transactions in try methods

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.

https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-handling-errors-using-try-methods#DbWriteTransactions

This is currently not prevented in Sandbox, just by default in Docker and OnPrem environments.

Read more here: https://demiliani.com/2023/02/08/dynamics-365-business-central-and-tryfunctions-be-careful/