Muokkaa

Jaa


OnBeforeValidate (Field Extension) trigger

Version: Available or changed with runtime version 1.0.

Runs before the user input is validated.

Syntax

trigger OnBeforeValidate()
begin
    ...
end;

Remarks

This trigger is run before the default validation behavior is executed on a record field entry, which are default checks such as data type validation. An error message displays if an error occurs in the trigger code. In case of an error, the user entry is not written to the database.

It applies to an already existing table field when it is being modified in a table extension.

Example

tableextension 50111 "CustomerExt" extends Customer
{
    fields
    {
        modify("Address 2")
        {
            trigger OnBeforeValidate()
            begin
                if (rec.Address = '') then
                    error('Please, input a first address before specifying a second one.');
            end;
        }
    }
}

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