Call to the function 'INSERT' is not allowed inside the call to when it is used as a TryFunction.

tomasevicstefan
Member Posts: 51
Hi all,
Does somebody know why this error occurs when I want to migrate some functionality to newer version, and how to solve it?
Regards,
Stefan
Does somebody know why this error occurs when I want to migrate some functionality to newer version, and how to solve it?
Regards,
Stefan
0
Best Answer
-
Hi
Check this article -https://msdn.microsoft.com/en-us/dynamics-nav/handling-errors-by-using-try-functions
As part of 2017 any call to Insert, Modify etc throws an error when called inside a Try Function. This is because Try Functions should not really be used for this kind of functionality and you should refactor the code to use IF CODEUNIT.RUN instead.
If this isn't an option, you can edit the value of the DisableWriteInsideTryFunctions setting in the CustomSettings.config file.5
Answers
-
Hi
Check this article -https://msdn.microsoft.com/en-us/dynamics-nav/handling-errors-by-using-try-functions
As part of 2017 any call to Insert, Modify etc throws an error when called inside a Try Function. This is because Try Functions should not really be used for this kind of functionality and you should refactor the code to use IF CODEUNIT.RUN instead.
If this isn't an option, you can edit the value of the DisableWriteInsideTryFunctions setting in the CustomSettings.config file.5 -
You can use the DisableWriteInsideTryFunctions as a temporary measure but you should restructure your code so that you do not have database changes within the TryFunction. The reason this restriction was added was for database integrity as the initial implementation of TryFunctions could result in partially committed / partially rolled back data.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions