OnLookup (Page fields) Trigger

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

Syntax

  
OnLookup(TextString)  

Parameters

TextString

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

Applies To

Fields on pages

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 (Fields) 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

OnLookup is also a field trigger at the table level. The flow is different for this trigger. When a lookup is requested, the page field's OnLookup trigger is executed if it is defined in the field lookup or system default. If no control lookup trigger is defined, the OnLookup (Fields) Trigger (if defined) replaces the system default lookup function.

Important

On non-editable fields in the Microsoft Dynamics NAV Windows client, the field lookup action is rendered as a hyperlink.

On non-editable fields in the Microsoft Dynamics NAV Web client, the OnLookup trigger is not invoked. This means, the lookup will not render in a Repeater control in view mode. In this case, you can use the OnDrillDown Trigger instead.

See Also

Triggers