getFieldDisplayValue(record, field)

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.

  • record—(Required) A Record object from which to retrieve the field value.
  • field—(Required) 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 5 levels of spanning fields. For example, Opportunity.Account.CreatedBy.LastModifiedById returns 4 levels of spanning fields.

A string that displays the field value. If the field doesn’t exist, this function returns undefined.

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.

See Also