2. About Me
Currently working as a software
engineer intern at SaasFocus.
Worked as a full stack developer
intern earlier.
3. Today’s Agenda
Introduction to Lightning Data Service
CRUD Operations in Lightning Data Service
Difference between <force:recordPreview /> and <force:recordData />
Important Considerations for using Lightning Data Service
Handling Result of Lightning Data Service
4. LDS Introduction
Lightning Data Service allows us to load, create, delete and edit a
record without requiring apex code.
Records loaded in Lightning Data Service are cached and shared across
all components
Field level security and record sharing is inbuilt
When one component updates a record, the other components using it
are notified.
Component usually refresh automatically if data is accessed in VIEW
mode
We have to manually refresh the component data in case of EDIT mode
6. <force:recordPreview /> v/s <force:recordData />
<force:recordPreview /> is deprecated and is completely replaced by
<force:recordData />
<force:recordData /> returns records in new shape and includes a new
attribute – targetFields
v.targetFields.Name === v.targetRecord.fields.Name.value
8. Considerations for LDS
Lightning Data Service is only available in Lightning Experience and
Salesforce1
Bulk operations are not supported in LDS
Querying for a record by anything other than record ID isn’t available
Lightning Data Service notifies listeners about data changes only if the
changed fields are the same as in the listener’s fields or layout.
Lightning Data Service Supports these objects :-
https://developer.salesforce.com/docs/atlas.en-
us.lightning.meta/lightning/data_service_considerations.htm
9. Resources
Lightning Data Service Trailhead -
https://trailhead.salesforce.com/modules/lightning_data_service
Developer Documentation -
https://developer.salesforce.com/docs/atlas.en-
us.lightning.meta/lightning/data_service.htm