# FieldRef.Name() Method
> Version: _Available or changed with runtime version 1.0._
Gets the name of a field as a string.
## Syntax
```al
Name :=   FieldRef.Name()
```
> NOTE
> This method can be invoked using property access syntax.
## Parameters
FieldRef
Type: fieldref-data-type
An instance of the fieldref-data-type data type.
## Return Value
Name
Type: ../text/text-data-type
## Remarks
The 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.
This method is similar to the ../record/record-fieldname-method.
## Example
The 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.
```al
var
    MyFieldRef: FieldRef;
    CustomerRecref: RecordRef;
    varName: Text;
    i: Integer;
    Text000: Label 'The name of field %1 is "%2".\\';
begin
    for i := 1 to 5 do begin
        CustomerRecref.Open(Database::Customer);
        MyFieldRef := CustomerRecref.Field(i);
        varName := MyFieldRef.Name;
        Message(Text000, i, varName);
        CustomerRecref.Close;
    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-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. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-name-method/
