# OnBeforeValidate (Field Extension) trigger
> Version: _Available or changed with runtime version 1.0._
Runs before the user input is validated.
## Syntax
```al
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
```al
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;
        }
    }
}
```
## Related information
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>
OnBeforeValidate (Page Field Extension) Trigger<../pagefieldextension/devenv-onbeforevalidate-pagefieldextension-trigger>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/triggers-auto/fieldextension/devenv-onbeforevalidate-fieldextension-trigger, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/triggers-auto/fieldextension/devenv-onbeforevalidate-fieldextension-trigger/
