+ Start a Discussion
BrianWXBrianWX 

LWC - Data Table with Inline Edit for related field

Salesforce provided an example on how to do Data Table with Inline Editing (https://developer.salesforce.com/docs/component-library/documentation/lwc/data_table_inline_edit) capability.  When displaying a related field in the datatable column, it displays the ID instead of the relatedObject.Name.

For example, if I have a field Assignee__c that is related to the User object.  When displaying the Assignee__c field in the data table, it only displays the ID of the Assignee__c instead of the look up field that we can search and select a new user.

Does anyone know how to get around this?

Thanks,
Brianwx
Best Answer chosen by BrianWX
Dhanya NDhanya N
Hi Brian,

I faced similar issue. What I did is  create a new object and assign all values to it.

I have commited my code into git. Please take a look into it. (line no: 20 - 30)
https://github.com/dhanyashree-kn/sortableLightningDataTable/blob/master/force-app/main/default/lwc/sortDataTable/sortDataTable.js

Thanks,
Dhanya

All Answers

Dhanya NDhanya N
Hi Brian,

I faced similar issue. What I did is  create a new object and assign all values to it.

I have commited my code into git. Please take a look into it. (line no: 20 - 30)
https://github.com/dhanyashree-kn/sortableLightningDataTable/blob/master/force-app/main/default/lwc/sortDataTable/sortDataTable.js

Thanks,
Dhanya
This was selected as the best answer
BrianWXBrianWX
Thanks, Dhanya.  This is a great approach.
ayeshy zoneayeshy zone
wow nice information i am devid (https://grandapk.com/en)