Roll back of data when error in OnModify of record

happyjoy
Member Posts: 10
On my vendor record I have set the NONBLANK property of the "Shipping Agent Code" to YES so it cannot be blank. A user opens the Vendor form, presses F3 for a new record. This runs the OnInsert trigger and gives a new numbered blank vendor record. The user then keys the vendor name, address, etc... and hits scroll to go to the next record, or tries to close the form.
At this point, the error occurs that says "Shipping Agent Code cannot be blank". That's great.. 8) ....except all the data they've entered disappears because the record is rolled back after the error occurs #-o .
How do I get the data they key to stay on the record after the error occurs?
At this point, the error occurs that says "Shipping Agent Code cannot be blank". That's great.. 8) ....except all the data they've entered disappears because the record is rolled back after the error occurs #-o .
How do I get the data they key to stay on the record after the error occurs?
"For in much wisdom is much grief, and he who increases knowledge increases sorrow." - Eccl. 1:18
0
Answers
-
happyjoy wrote:On my vendor record I have set the NONBLANK property of the "Shipping Agent Code" to YES so it cannot be blank. A user opens the Vendor form, presses F3 for a new record. This runs the OnInsert trigger and gives a new numbered blank vendor record. The user then keys the vendor name, address, etc... and hits scroll to go to the next record, or tries to close the form.
At this point, the error occurs that says "Shipping Agent Code cannot be blank". That's great.. 8) ....except all the data they've entered disappears because the record is rolled back after the error occurs #-o .
How do I get the data they key to stay on the record after the error occurs?
simple way to do this check is :
1. Set InitialValue of Block field as "All"
2. OnValidate trigger of "Block" trigger, check that shipping agent code is filled in.
3. tell your users to unblock vendor after entering vendor informations.
PS: crosscheck may be needed in OnValidate trigger of shipping agent code0 -
That would work on initial record entry, but nothing prevents them from blanking it out later on when Blocked is blank. The field cannot be blank on a Vendor - ever."For in much wisdom is much grief, and he who increases knowledge increases sorrow." - Eccl. 1:180
-
THan you can add code which will again block the record when someone clear the field... ;-)0
-
Yes, from experience this is the only nice way to do it.0
-
Sounds like a plan! Thanks to all!"For in much wisdom is much grief, and he who increases knowledge increases sorrow." - Eccl. 1:180
-
well if you set the field to NotBlank and you use the above example to block on insert & testfield - you will not be able to blank the field out - it will always need a value0
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