Microsoft Dynamics NAV recognizes certain actions that happen to a table when you use it, for example, that you insert or modify data. In response, you can set up Microsoft Dynamics NAV to execute C/AL code defined in a trigger. Triggers are predefined functions that are executed when certain actions happen. The bodies of these functions are initially empty and must be defined by the developer. Defining C/AL code in triggers allows you to change the default behavior of Microsoft Dynamics NAV.
The triggers in a table can be divided into two categories:
Tables have the following triggers.
|Table trigger||Executes when|
A new record is inserted into the table.
A record in the table is modified.
A record in the table is deleted.
A record is modified in a primary key field.
Fields have the following triggers.
|Field trigger||Executes when|
Data is entered in a field or when the VALIDATE Function (Record) is executed.
Lookup is activated.