{"title":"Record.Validate(Any [, Any]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-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/record/record-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/record/record-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":"Calls the OnValidate trigger for the field that you specify.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Record.Validate(Any [, Any]) Method","slug":"recordvalidateany-any-method","at":0,"chars":1823},{"level":2,"title":"Syntax","slug":"syntax","at":159,"chars":67},{"level":2,"title":"Parameters","slug":"parameters","at":226,"chars":248},{"level":2,"title":"Code example","slug":"code-example","at":474,"chars":1215},{"level":2,"title":"Related information","slug":"related-information","at":1689,"chars":134}],"text":"# Record.Validate(Any [, Any]) Method\n> Version: _Available or changed with runtime version 1.0._\nCalls the OnValidate trigger for the field that you specify.\n## Syntax\n```al\n Record.Validate(Field: Any [, NewValue: Any])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\nField\nType: ../any/any-data-type\nA field together with associated triggers.\n*[Optional] NewValue*\nType: ../any/any-data-type\nThe value to insert into Field.\n## Code example\nThe following example shows how to use the Validate method to validate a field in a record. The example uses the Customer table and validates the fields `\"No.\"`, Name, `\"Phone No.\"`, Address, and City. The Validate method not only assigns the value but also triggers any validation logic defined for the field in the table. This ensures that the data adheres to any business rules or constraints defined in the table. The `CustomerRec.Insert()` method is called to insert the newly created and validated record into the database. This step commits the data, making it available for use in the system.\n```al\ncodeunit 50222 MyCodeunit\n{\n    local procedure ValidateCustomerFields()\n    var\n        CustomerRec: Record Customer;\n    begin\n        // Initialize the record\n        CustomerRec.Init();\n\n        // Validate and set fields\n        CustomerRec.Validate(\"No.\", '1234');\n        CustomerRec.Validate(Name, 'Windy City Solutions');\n        CustomerRec.Validate(\"Phone No.\", '555-444-333');\n        CustomerRec.Validate(Address, '1241 Druid Avenue');\n        CustomerRec.Validate(City, 'Windy City');\n\n        // Insert the record into the database\n        CustomerRec.Insert();\n    end;\n}\n```\n## Related information\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}