{"title":"FieldRef.Name() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-name-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-name-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-name-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":"Gets the name of a field as a string.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":98,"chars":112},{"level":2,"title":"Parameters","slug":"parameters","at":210,"chars":97},{"level":2,"title":"Return Value","slug":"return-value","at":307,"chars":50},{"level":2,"title":"Remarks","slug":"remarks","at":357,"chars":346},{"level":2,"title":"Example","slug":"example","at":703,"chars":899},{"level":2,"title":"Related information","slug":"related-information","at":1602,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the name of a field as a string.\n## Syntax\n```al\nName :=   FieldRef.Name()\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## Return Value\nName\nType: ../text/text-data-type\n## Remarks\nThe Caption Method \\(FieldRef, TestPage Field\\)<fieldref-caption-method> method retrieves the ../../properties/devenv-caption-property of a field. To enable your application for multilanguage functionality, you must use the ../record/record-fieldcaption-method instead.\nThis method is similar to the ../record/record-fieldname-method.\n## Example\nThe following example opens the Customer table as a RecordRef variable that is named CustomerRecref. The ../recordref/recordref-field-method creates a reference to the fields in the table and stores the FieldRef in the MyFieldRef variable. The code loops through field 1 through 5. For each field, the Name method retrieves the name of the field and stores the value in the varName variable. The field number and the value in the varName variable are displayed in a message box.\n```al\nvar\n    MyFieldRef: FieldRef;\n    CustomerRecref: RecordRef;\n    varName: Text;\n    i: Integer;\n    Text000: Label 'The name of field %1 is \"%2\".\\\\';\nbegin\n    for i := 1 to 5 do begin\n        CustomerRecref.Open(Database::Customer);\n        MyFieldRef := CustomerRecref.Field(i);\n        varName := MyFieldRef.Name;\n        Message(Text000, i, varName);\n        CustomerRecref.Close;\n    end;\nend;\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}