web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Using Table Trigger events on table extensions

(0) ShareShare
ReportReport
Posted on by

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

Categories:
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans