Field triggers
To see field triggers, let us look at our Table 50000 - Radio Show. Open the table in the Design mode, highlight the No. field, press F9, and you will see the following screenshot:
Each field has two triggers, the OnValidate()
trigger and the OnLookup()
trigger, which function as follows:
OnValidate()
: The C/AL code in this trigger is executed whenever an entry is made by the user. Its intended use is to validate that the entry conforms to the design parameters for the field. It can also be executed under program control through the use of theVALIDATE
function (which we will discuss later).OnLookup()
: OnLookup behavior can be triggered by pressing F4 or Shift + F4 from an ellipsis button or by clicking on the lookup arrow in a field, as shown in the following screenshot:- If the field's TableRelation property refers to a table, then the default behavior is to display a drop-down list to allow the selection of a table entry to store it in this field. The list will...