Edit

OnAfterValidate (Field Extension) trigger

Version: Available or changed with runtime version 1.0.

Runs after the user input is validated.

Syntax

trigger OnAfterValidate()
begin
    ...
end;

This trigger is after 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 OnAfterValidate()
            begin
                if (rec."Address 2" = rec.Address) then
                    error('The second address cannot be the same as the first one.');
            end;
        }
    }
}    

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