The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
FIELDCAPTION Method (Record)
Gets the current caption of the specified field as a string.
Caption := Record.FIELDCAPTION(Field)
The record that holds the field for which you want to retrieve the caption.
The field for which you want to retrieve the caption.
Property Value/Return Value
Type: Text or code
The caption is a string.
The FIELDCAPTION method 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.
The following example uses the FIELDCAPTION method to retrieve the caption of the Address 2 field in the Customer table. The method 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 global variables.
varFieldCaption := MyRecord.FIELDCAPTION("Address 2"); MESSAGE(varFieldCaption);