# FxUI.objectApi.format_field_value(fieldDescribe, value, fullValue)

This method allows you to parse the value of a certain type of field into readable content.

# parameter

parameter illustrate type Optional value Default value
fieldDescribe Field description information (required) Object
value The value of the field *
fullValue All values for the field string

# value and fullValue

Suppose you have a field with apiName field_lookup__c of type .object_reference The data for this field is stored as:

var fieldData = {
    field_lookup__c: '5f2bb8364e6e300001824a37',
    field_lookup__c__r: 'lookup对象的名称'
}

It is not difficult to find that the storage of this field involves two parameters, and some fields even involve three parameters. For this api, fieldData.field_ lookup__ C is value, and fieldData is fullValue.

The usage that follows shows a complete example.

# usage

const field = {
    api_name: 'field_lookup__c',
    type: object_reference,
    label: '关联客户',
    ...
}
const data = {
    field_lookup__c: '5f2bb8364e6e300001824a37',
    field_lookup__c__r: '某某公司'
}
const value = FxUI.objectApi.format_field_value(field, data[field.field_lookup__c], data);

console.log(value); // 某某公司

# Tips for use

In most cases, we can't tell how many parameters the field stores there, so let's directly pass all the data obtained as fullValue into the api, for example:

const field = {
    api_name: 'field_lookup__c',
    type: object_reference,
    label: '关联客户',
    ...
}
const data = {
    field_lookup__c: '5f2bb8364e6e300001824a37',
    field_lookup__c__r: '某某公司',

    //以下为其他字段的值
    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); // 某某公司
lastUpdate: 10/21/2022, 5:22:27 PM