Back to Top

Lightning Data Services for Developers

Updated 28 December 2016

Lightning data services for developers is used to load, create, edit, or delete a record in the component, without requiring Apex code.Lightning Data Service handles sharing rules and field level security also.In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.

Services

1) Loading a Record
To load a record using Lightning Data Service, add the force:recordPreview tag to your component. In the force:recordPreview tag, specify the ID of the record to be loaded, a list of fields, and the attribute to which to assign the loaded record.

2) Saving a Record
To save a record using Lightning Data Service, call saveRecord on the force:recordPreview component, and pass in a callback function to be invoked after the save operation completes.

3) Creating a Record
To create a record using Lightning Data Service, first declare force:recordPreview without assigning a recordId. Then load a record template by calling the getNewRecord function on force:recordPreview. Finally, apply values to the new record, and save the record by calling the saveRecord function on force:recordPreview.

4) Deleting a Record
To delete a record using Lightning Data Service, call deleteRecord on the force:recordPreview component, and pass in a callback function to be invoked after the delete operation completes.

Searching for an experienced
Salesforce Company ?
Find out More

lightning data services for developers

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home

Table of Content