0

I'm creating the lightning:datatable dynamically and passing the data by querying from contact object, and I have a parent Account.name field in the SOQL query and I have specified the field Account.Name with type reference in the columns attribute but account name value is not populating, it's displaying only the AccountId, but it should display Account Name, is there any possibility to display the Reference field value not exactly sfdc record id.

$A.createComponent(
 "lightning:datatable",
 {   
    'aura:id': 'dynamicChild',
    'data': component.get('v.all'),
    'columns': component.get('v.tColumns'),
    'hideCheckboxColumn': 'true',
    'keyField': 'Id',
    'minColumnWidth': 5,
    'maxColumnWidth': 10,
    'sortedDirection': 'asc'
 },
 function(datatable){
    if (component.isValid())
        tab.set('v.body', datatable);
    else throw new Error(error);
 });

Thanks in advance.

0

This cannot be done straight from the object that you get from apex - you will need to flatten the object that you get - see my question about the exact same issue here:

Winter 18 does not get values from a parent record

There is an answer there on how to flatten the records

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.