{"title":"FieldRef.Value([Any]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-value-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-value-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-value-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":"Sets or gets the value of the field that is currently selected.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"FieldRef.Value([Any]) Method","slug":"fieldrefvalueany-method","at":0,"chars":2136},{"level":2,"title":"Syntax","slug":"syntax","at":209,"chars":131},{"level":2,"title":"Parameters","slug":"parameters","at":340,"chars":146},{"level":2,"title":"Return Value","slug":"return-value","at":486,"chars":62},{"level":2,"title":"Remarks","slug":"remarks","at":548,"chars":199},{"level":2,"title":"Example","slug":"example","at":747,"chars":1253},{"level":2,"title":"Related information","slug":"related-information","at":2000,"chars":136}],"text":"# FieldRef.Value([Any]) Method\n> Version: _Available or changed with runtime version 1.0._\nSets or gets the value of the field that is currently selected. This method returns an error if no field is selected.\n## Syntax\n```al\n[Value := ]  FieldRef.Value([NewValue: Any])\n```\n> NOTE\n> This method can be invoked using property access syntax.\n## Parameters\nFieldRef\nType: fieldref-data-type\nAn instance of the fieldref-data-type data type.\n*[Optional] NewValue*\nType: ../any/any-data-type\n## Return Value\n*[Optional] Value*\nType: ../any/any-data-type\n## Remarks\nIf you omit NewValue, the method returns the current value of the field.\nIf you want to format the value of a FieldRef you must use `Format(FieldRef)` instead of `Format(FieldRef.Value)`.\n## Example\nThe following example opens table 18, the Customer table, a RecordRef variable that is named CustomerRecref. The ../recordref/recordref-field-method creates a FieldRef for the first field \\(No.\\). The reference to the field is stored in the MyFieldRef variable. The fieldref-active-method method determines whether the field is enabled. If the field is enabled, then the record that is identified by the number in the CustomerNo variable is selected. The MyFieldRef variable is updated to refer to the second field \\(Name\\). Then the value in the second field is changed to Contoso. The ../recordref/recordref-modify-method modifies the record in the table to reflect the change. MyFieldRef.Value retrieves the new name and displays it in message box.\n```al\nvar\n    MyFieldRef: FieldRef;\n    CustomerRecref: RecordRef;\n    CustomerNo: Code;\n    Text000: Label 'Customer name has changed to %1.';\nbegin\n    CustomerNo := '50000';\n    CustomerRecref.Open(18);\n    MyFieldRef := CustomerRecref.Field(1);\n    if MyFieldRef.Active then begin\n      MyFieldRef.Value(CustomerNo);\n      MyFieldRef := CustomerRecref.Field(2);\n      MyFieldRef.Value('Contoso');\n      CustomerRecref.Modify;\n      Message(Text000, MyFieldRef.Value);\n    end;\nend;\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}