Gets the display value of a field. Spanning fields are supported.
The display value provides formatted and localized values based on the org’s locale settings. In some cases, the display value differs from the value of a field in its raw data form returned by getFieldValue(record, field). For information about these cases, see Field Value.
A Record object from which to retrieve the field value.
field
String
The API name of the field. The value can be either a string or reference to a field imported from @salesforce/schema. You can specify up to three relationship fields to reference parent objects and fields using this format: <SObjectName>.<relationship-1>.<relationship-2>.<relationship-3>.<fieldName>.
Returns
A string that displays the field value. If the field doesn’t exist, this function returns undefined.
Usage
To get a field’s display value, you can use the getRecord wire adapter which returns the property record.data.fields.fieldName.displayValue. However, to get the value of the property directly, call getFieldDisplayValue(record, field).
The display value is returned in its localized and formatted form. For example, if your Salesforce locale is English (United States):
Currency values are displayed in the format $350,000,000.
Date values are displayed in the format 7/13/2019.
Date/time values are displayed in the format 6/17/2015 3:17 PM.
getFieldDisplayValue returns undefined if a localized or formatted value is not available.
This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.