共用方式為


Table and Field Triggers

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:

  • 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 Function (Record) is executed.

OnLookup (Fields) Trigger

Lookup is activated.

See Also

Tasks

How to: Define or Modify Table or Field Triggers