Leveraging Lightning Data Service in Lightning Framework
LDS

Leveraging Lightning Data Service in Lightning Framework

Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you. In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.

At the simplest level, you can think of Lightning Data Service as the Lightning Components version of the Visualforce standard controller. While this statement is an over-simplification, it serves to illustrate a point. Whenever possible, use Lightning Data Service to read and modify Salesforce data in your components.

Data access with Lightning Data Service is simpler than the equivalent using a server-side Apex controller. Read-only access can be entirely declarative in your component’s markup. For code that modifies data, your component’s JavaScript controller is roughly the same amount of code, and you eliminate the Apex entirely. All your data access code is consolidated into your component, which significantly reduces complexity.

Below is a quick example to demonstrate usage of LDS to fetch the account name from the client side without having to actually making server side round trip. This name is used in the client side controller to open a tableau report specific to this account.

 

codeyinthecloud

I am a driven individual specializing in Salesforce Development and Consulting. My education includes a Master’s Degree in Electrical Engineering and Bachelor’s Degree in Electronics and Communications Engineering. I have a strong background managing the implementation of cloud based solutions, and administering Salesforce CRM and other applications.Since 2016 I’ve worked as a Salesforce Developer and Salesforce Lightning Consultant for various organizations.

Leave a Reply

Close Menu