OnLookup (Field) Trigger

Version: Available or changed with runtime version 1.0.

Runs when a lookup page is displayed.

Syntax

trigger OnLookup()
begin
    ...
end;

Remarks

The Lookup Property must be set to True to enable the lookup.

There are three lookup options:

  1. Default Lookup - The lookup into the table is performed without applying filters or other special parameters.
  2. Field Lookup - You can use this trigger to define a field lookup that will be used in place of the default lookup.
  3. Text box Lookup - You can use the OnLookup (Page fields) Trigger to define a lookup based on the value of a text box. This value will be used in place of the default lookup or the field lookup.

When using this trigger, follow this approach:

  • Use the field value to determine what filters or other parameters to apply.

  • Run the lookup page as a modal page.

  • Transfer the value the user selects back to the field when the user chooses OK.

If an error occurs in the trigger code, the lookup page is closed.

Note

The lookup for a non-editable field is not rendered. You can use the OnDrillDown Trigger instead.

See Also

Get Started with AL
Developing Extensions
OnLookup (Page Field) Trigger
OnLookup (Page Field Extension) Trigger