Best method to Add field validation in BC SaaS

jordi79
Member Posts: 280
Hi,
There are 2 ways to add a validation trigger to an existing field in BC.
1) Subscriber codeunit that subscribes to the table OnAfterValidate Event
2) A TableExtension that Modifies the field OnAfterValidate trigger
Which is best and what is the pros and cons of each method?
All this while I have been using the Subscriber codeunit method, until recently when I realised that I could also achieve the same using a TableExtension.
Thanks for reading.
There are 2 ways to add a validation trigger to an existing field in BC.
1) Subscriber codeunit that subscribes to the table OnAfterValidate Event
2) A TableExtension that Modifies the field OnAfterValidate trigger
Which is best and what is the pros and cons of each method?
All this while I have been using the Subscriber codeunit method, until recently when I realised that I could also achieve the same using a TableExtension.
Thanks for reading.
0
Answers
-
It is the same afaik. I move my subscribers to the pageeext onaftervalidate as soon a there is one. It provides a better insight in What is modified.0
-
It is the same afaik. I move my subscribers to the pageeext onaftervalidate as soon a there is one. It provides a better insight in What is modified.
But, adding the logic to the PageExtension would only fire the code if the field was modified from that particular page which the page extension is extending. if you want the code to fire no matter which page the field was modified from, I suggest using the Table Extension or the Codeunit Method subscribing to the Table's OnAfterValidate Event.0 -
I'm sorry, I meant tableextension where i wrote paggextension0
-
I think the table trigger events written as subscriber was used to support older versions of NAV. E.g. before BC14. This was because before BC14, you cannot write TableExt in C/side. So to get around this, we can subscribe to table events (delete, insert, modify...) via a subscriber codeunit.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