Gets the current caption of the specified field as a string.

Caption := Record.FIELDCAPTION(Field)

Parameters

Record

Type: RecordThe record that holds the field for which you want to retrieve the caption.
Field

Type: FieldThe field for which you want to retrieve the caption.

Property Value/Return Value

Type: Text or code

The caption is a string.

Remarks

The FIELDCAPTION function returns the caption of a specified field. FIELDCAPTION searches for a CaptionML Property. If none is found, the Name Property is used. This means that FIELDCAPTION has multilanguage functionality.

Example

The following example uses the FIELDCAPTION function to retrieve the caption of the Address 2 field in the Customer table. The function stores the retrieved caption in the varFieldCaption variable and displays it in a message box. In this Customer table, the field name is the same as the caption so the value Address 2 is displayed for the caption. If you change the caption for Address 2 in the Address 2 property window, then the new caption will be displayed. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType Subtype

MyRecord

Record

Customer

varFieldCaption

Text

Not applicable

  Copy Code
varFieldCaption := MyRecord.FIELDCAPTION("Address 2");
MESSAGE(varFieldCaption);

See Also