Can't Modify Database From Trigger

headley27
Member Posts: 188
C/AL makes me crazy ](*,)
I am trying to modify the database using Rec.MODIFY from the 'Form - OnNextRecord(Steps : Integer) : Integer' but I receive the message 'You cannot make any changes in the database from this trigger.'
'Form - OnBeforePutRecord()' which has a description of 'The C/AL code in this trigger is executed before a record is saved. ' gives me the same message.
I simply want to clear a couple of fields if a certain criteria is met, before leaving a record displayed in the Sales Quote Form.
This would be required on insert of a new record, on close of the form, choosing the next record, choosing the previous record, etc.
Is there a standard way of doing this? I am using 3.7A.
Any help is greatly appreciated. Thank you.
I am trying to modify the database using Rec.MODIFY from the 'Form - OnNextRecord(Steps : Integer) : Integer' but I receive the message 'You cannot make any changes in the database from this trigger.'
'Form - OnBeforePutRecord()' which has a description of 'The C/AL code in this trigger is executed before a record is saved. ' gives me the same message.
I simply want to clear a couple of fields if a certain criteria is met, before leaving a record displayed in the Sales Quote Form.
This would be required on insert of a new record, on close of the form, choosing the next record, choosing the previous record, etc.
Is there a standard way of doing this? I am using 3.7A.
Any help is greatly appreciated. Thank you.
0
Answers
-
Found a solution here that works quite nicely.
At least I can stop the user from navigating anywhere else until they make a change to the record -
using the code IF ("No." <> xRec."No.") AND (xRec."No." <> '') THEN BEGIN .... etc.
http://www.mibuso.com/forum/viewtopic.php?t=5167&highlight=modify+trigger0 -
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