OnLookup (Page Field) Trigger

Version: Available or changed with runtime version 1.0.

Runs in place of the normal lookup features for the current page.

Syntax

trigger OnLookup(var Text: Text): Ok
begin
    ...
end;

Parameters

Text
 Type: Text
Text string entered into the text box and used as the lookup value.

Return Value

Ok
 Type: Boolean
true if the lookup was carried out,otherwise, false.

Remarks

There are three lookup options:

  • Default Lookup - The lookup into the table is performed without applying filters or other special parameters.

  • Field Lookup - You can define a lookup trigger on a field that will be used in place of the default lookup. For more information, see OnLookup (Field) Trigger.

  • Text box Lookup - You can use this 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.

For example, for the Customer Code field, a lookup into the Customer table is provided. If you want a lookup into another table or if you want to place a filter on the table before displaying the lookup, use this trigger.

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

You can use this trigger to write to the database.

Note

If you have defined an OnLookup trigger, the OnAfterLookup Trigger will not be fired.

Note

When a lookup is requested, the page field's OnLookup trigger is executed if it is defined. If no page field lookup trigger is defined, the OnLookup (Field) Trigger trigger on the table (if defined) replaces the system default lookup.

See Also

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