{"title":"FieldRef.Validate([Any]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-validate-method/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-validate-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"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.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"FieldRef.Validate([Any]) Method","slug":"fieldrefvalidateany-method","at":0,"chars":2170},{"level":2,"title":"Syntax","slug":"syntax","at":243,"chars":56},{"level":2,"title":"Parameters","slug":"parameters","at":299,"chars":180},{"level":2,"title":"Remarks","slug":"remarks","at":479,"chars":310},{"level":2,"title":"Example","slug":"example","at":789,"chars":1245},{"level":2,"title":"Related information","slug":"related-information","at":2034,"chars":136}],"text":"# FieldRef.Validate([Any]) Method\n> Version: _Available or changed with runtime version 1.0._\nUse 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.\n## Syntax\n```al\n FieldRef.Validate([NewValue: Any])\n```\n## Parameters\nFieldRef\nType: fieldref-data-type\nAn instance of the fieldref-data-type data type.\n*[Optional] NewValue*\nType: ../any/any-data-type\nThe value to insert in the field.\n## Remarks\nThe Validate method first checks any ../../properties/devenv-tablerelation-property, and then executes the ../../triggers-auto/field/devenv-onvalidate-field-trigger of the field.\nIf you omit NewValue, the method validates the current value.\nThis method is like the ../record/record-validate-method.\n## Example\nThe 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.');`\n```al\nvar\n    MyFieldRef: FieldRef;\n    EntryRecref: RecordRef;\n    Text000: Label 'The G/L Account No. for record %1 is %2.';\n    Text001: Label 'The G/L Account No. for record %1 has changed to %2.';\nbegin\n    EntryRecref.Open(17);\n    if EntryRecref.FindFirst then begin\n      MyFieldRef := EntryRecref.Field(3);\n      Message(Text000, EntryRecref.RecordId, MyFieldRef.Value);\n      MyFieldRef.Validate('1210');\n      EntryRecref.Modify;\n      Message(Text001, EntryRecref.RecordId, MyFieldRef.Value);\n    end;\nend;\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}