function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shuhbam SinhaShuhbam Sinha 

How to update a list of records in a single DML in LWC

Hello Everyone,
I have a scenario where I am showing list of records by using LWC and some  of the fields are editable to users. I have used combobox to show the picklist values editable and calling the apex method to update the record on ONCHANGE event but the requirement is to create a SAVE button and save the records. So the challenge is  let say if user changess the multiple records and click the save button then how do i update all the records in a single go with this save button .
Please help me on this. Thanks in advance.
charchit nirayanwal 2charchit nirayanwal 2

Hello Shubham 

For this, you can use a JSON to store all the data, and on change of the values just update into the JSON and pass that same in APEX to update.

Shuhbam SinhaShuhbam Sinha
Thanks Charchit. Can you please help how to create the JSON in JS  and add the multiple values into it along with Id.
Juber kimberJuber kimber
Hello, I have a requirement where a particular trigger point on one record (through LWC) requires many other records to be updated. If I have to update say 10 records without using apex, would I need to hit the udpateRecordApi 10 times in a loop? Won't it have performance or governor limit issues? https://www.myinsite.biz/