Skip to main content

Notifications

Business Central forum

Using Table Trigger events on table extensions

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:
  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Using Table Trigger events on table extensions

    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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans