[SalesForce] LWC Datatable – Turn Custom Lookup Field Value in Editable Datatable to Draft Value for Mass Update

As you know, datatables do not support lookup field. I've built a search lookup field that queries an object, and added that to the LWC datatable as a custom type.

  • The id of the selected record (Product Name column in the image below) is propagated to the datatable component
  • I'm trying to turn that id into a draft value so I can mass update both product name and quantity (refer to image below) using the save function.

Anyone has done something similar before? Willing to share your solution or code snippet, specifically for Lightning Web Component? Anything is helpful at this point.

Image Reference

enter image description here

Appreciate any help on this matter. Thanks all.

Best Answer

You need to update draft values while updating the lookup. Please check https://live.playg.app/play/lookup-in-lightning-datatable-lwc

Related Topic