Triggers versus Events

All the objects in Microsoft Dynamics NAV (from the first version of the product) have triggers.

Triggers are predefined functions inside an object that are automatically executed when certain actions occur on the object itself. The body of this function could be empty (no actions required) or could contain code (that is automatically executed when the trigger occurs). Defining C/AL code in triggers allows you to change the default behavior of Microsoft Dynamics NAV.

As an example, if we open the Customer table, we can see that we have triggers for the table object (OnInsert, OnModify, OnDelete, OnRename) and triggers for the different table fields (OnValidate, OnLookup):

If we open the OnInsert trigger, we can see ...

Get Dynamics 365 Business Central Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.