The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

Table and Field Triggers

Dynamics 365 for Finance and Operations, Business edition recognizes certain actions that happen to a table when you use it, for example, when you insert or modify data. In response, you specify to execute AL code defined in a trigger. Triggers are predefined methods that are executed when certain actions happen. The bodies of these methods are initially empty and must be defined by the developer. Defining AL code in triggers allows you to change the default behavior of Dynamics 365.

The triggers in a table can be divided into two categories:

  • Table triggers

  • Field triggers

Tables have the following triggers.

Table trigger Executes when
OnInsert Trigger A new record is inserted into the table.
OnModify Trigger A record in the table is modified.
OnDelete Trigger A record in the table is deleted.
OnRename Trigger A record is modified in a primary key field.

Fields have the following triggers.

Field trigger Executes when
OnValidate (Fields) Trigger Data is entered in a field or when the VALIDATE Record) is executed.
OnLookup (Fields) Trigger Lookup is activated.

See Also

Table and Table Extension Properties