Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lightning Data Service


Published on

An introduction to lightning data service and it's implementation presented by me in DF17GG organized by Noida Salesforce Developer User Group

Published in: Software
  • Be the first to comment

  • Be the first to like this

Lightning Data Service

  1. 1. - Rahul Malhotra
  2. 2. About Me  Currently working as a software engineer intern at SaasFocus.  Worked as a full stack developer intern earlier.
  3. 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. 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
  5. 5. CRUD Operations in LDS <force:recordData aura:id="forceRecordCmp" recordId="{!v.recordId}" layoutType="{!v.layout}" fields="{!v.fieldsToQuery}" mode="VIEW" targetRecord="{!v.record}" targetFields="{!v.simpleRecord}" targetError="{!v.error}" /> Methods Available  getNewRecord()  reloadRecord()  saveRecord()  deleteRecord()
  6. 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
  7. 7. It’s Time to Code
  8. 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 :- us.lightning.meta/lightning/data_service_considerations.htm
  9. 9. Resources  Lightning Data Service Trailhead -  Developer Documentation - us.lightning.meta/lightning/data_service.htm
  10. 10. Q & A
  11. 11. Thank You  Github Project Link:-  My Twitter Handle:- @rahulcoder  About Me:  Salesforce Chatter:  Blog: