English
format_field_value
About 233 wordsLess than 1 minute
2025-12-16
This method allows you to parse the value of a field type into readable content.
Syntax: format_field_value(fieldDescribe, value, fullValue)
Parameters
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| fieldDescribe | Field metadata (required) | Object | — | — |
| value | Value corresponding to the field | * | — | — |
| fullValue | Complete data object that contains the field value | string | — | — |
value and fullValue
Assume there is a field whose apiName is field_lookup__c, and the field type is object_reference.
The field data is stored as follows:
var fieldData = {
field_lookup__c: '5f2bb8364e6e300001824a37',
field_lookup__c__r: 'Lookup Object Name'
}As you can see, storing this field involves two parameters, and some fields may even involve three. For this API, fieldData.field_lookup__c is value, and fieldData is fullValue.
The following usage section shows a complete example.
Example
const field = {
api_name: 'field_lookup__c',
type: object_reference,
label: 'Related Customer',
...
}
const data = {
field_lookup__c: '5f2bb8364e6e300001824a37',
field_lookup__c__r: 'Example Company'
}
const value = FxUI.objectApi.format_field_value(field, data[field.field_lookup__c], data);
console.log(value); // Example CompanyTips
In most cases, it is difficult to determine how many related parameters a field stores. A better approach is to pass the entire data object as fullValue, for example:
const field = {
api_name: 'field_lookup__c',
type: object_reference,
label: 'Related Customer',
...
}
const data = {
field_lookup__c: '5f2bb8364e6e300001824a37',
field_lookup__c__r: 'Example Company',
// values of other fields
name: 'Example Name',
_id: '23zd323asdf33333asddx2333s3',
field1__c: '233',
field1__c: '233',
field1__c: '233',
...
}
const value = FxUI.objectApi.format_field_value(field, data[field.field_lookup__c], data);
console.log(value); // Example Company