OnNewRecord (Page Extension) trigger

Version: Available or changed with runtime version 1.0.

Runs after a new record is initialized, but before it is inserted as a record in the table.

Syntax

trigger OnNewRecord(BelowxRec: Boolean)
begin
    ...
end;

Parameters

BelowxRec
 Type: Boolean
This return value indicates whether the new record is to be inserted after the last record in the table (xRec). If false, the record is to be inserted between an existing record and the last record. If true, the record is to be inserted below the last record in the table (xRec).

Remarks

Use this trigger to initialize a new record or other variables on the page. This is run before users enter any data in the record.

If an error occurs in the trigger code a popup dialog shows an error message. When the dialog is closed, the user can enter new data.

Important

For pages of the type Card, List, ListPlus, Document, or Worksheet, the OnNewRecord trigger is called more than once if the page is opened in the edit mode and does not have any records to display. If the page is opened in the view mode or displays a record, the trigger is called only once.

Note

The OnNewRecord trigger does not support calls to control add-in methods and properties because the trigger is invoked before the page is instantiated.

Get Started with AL
Developing Extensions
OnNewRecord (Page) Trigger
OnNewRecord (Request Page) Trigger
OnNewRecord (Request Page Extension) Trigger