Hi to all,
There are actually two ways of writing a table trigger Event in VS Code:
1) Creating a Codeunit and subscribing to the event (OnBeforeValidateEvent,OnAfterValidateEvent,etc)
2) Creating a Table extension, modifying the standard field and writing code on the trigger "OnAfterValidate" of the field
As the two alternatives are, in a semantic way, totally identic, is there a difference in terms of performance or other aspects that I do not see in the first place?
Thanks in advance for your suggestions,
Andrea Antolini
Performances: no.
Normally I prefer the second way. In your custom table, you should write code in the OnValidate trigger of the field (the tabkle is yours).
In a custom table, a tableextension creates an object on the underlying database that can be unuseful for handling only code in an event. I prefer the usage of the event-based programming, so a codeunit with an event subscriber.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156