Salesforce Fact #164 | LWC: Add attribute to records of apex response collection

When we are fetching the data from apex in LWC, if we need to add a new attribute to each of the record of the response collection we cannot simply add it to the original collection.

We can make use of the array.map() method as it returns a new collection and we can use the spread operator to add the attribute.

Attached is the screenshot.


 

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow