# FieldRef.Validate([Any]) Method
> Version: _Available or changed with runtime version 1.0._
Use this method to enter a new value into a field and have the new value validated by the properties and code that have been defined for that field.
## Syntax
```al
 FieldRef.Validate([NewValue: Any])
```
## Parameters
FieldRef
Type: fieldref-data-type
An instance of the fieldref-data-type data type.
*[Optional] NewValue*
Type: ../any/any-data-type
The value to insert in the field.
## Remarks
The Validate method first checks any ../../properties/devenv-tablerelation-property, and then executes the ../../triggers-auto/field/devenv-onvalidate-field-trigger of the field.
If you omit NewValue, the method validates the current value.
This method is like the ../record/record-validate-method.
## Example
The following example opens table 17 \(G/L Entry\) as a RecordRef that is named EntryRecref. The ../recordref/recordref-findfirst-method searches for the first record in the table. The ../recordref/recordref-field-method sets the field to 3, which is the G/L Account No. field. The VALIDATE method validates and inserts the specified value \(1210\) into the field. The ../recordref/recordref-modify-method modifies the table. A message that indicates the G/L Account No. field has changed is displayed. To show that the code in the OnValidate trigger is executed, design the G/L Entry table and add the following code to the G/L Account No. - OnValidate trigger: `Message('The OnValidate trigger is called.');`
```al
var
    MyFieldRef: FieldRef;
    EntryRecref: RecordRef;
    Text000: Label 'The G/L Account No. for record %1 is %2.';
    Text001: Label 'The G/L Account No. for record %1 has changed to %2.';
begin
    EntryRecref.Open(17);
    if EntryRecref.FindFirst then begin
      MyFieldRef := EntryRecref.Field(3);
      Message(Text000, EntryRecref.RecordId, MyFieldRef.Value);
      MyFieldRef.Validate('1210');
      EntryRecref.Modify;
      Message(Text001, EntryRecref.RecordId, MyFieldRef.Value);
    end;
end;
```
## Related information
fieldref-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

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/methods-auto/fieldref/fieldref-validate-method, 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/methods-auto/fieldref/fieldref-validate-method/
