When to use Apex over LDS functions?

When to use Apex over LDS functions?

Have you ever been stuck on deciding to choose in between LDS functions and Apex methods? Let's answer this dilemma

If you come across a situation where you need to update more than one records in the database that needs to be updated all or none then I would suggest Apex methods over LDS.

Why? Apex supports transactions that will rollback all other DMLs if any one of the DML fails. That support I did not come across in LDS. In LDS, every function runs in separate transactions. For other simpler tasks LDS is great.

Note: LDS means Lightning Data Service, LDS functions are also known as wire adaptors.

Nikhil Karkra

Salesforce UI Architect | Full Stack Developer | JavaScript, TypeScript, NextJS, React | Omnistudio | LWC | Node.js | Responsiveness | Accessibility | Testing | Automation | Performance Optimization

4 年

What about uiRecordApi?

回复

要查看或添加评论,请登录

Harshita Khandelwal的更多文章

社区洞察

其他会员也浏览了