Data Service

Lightning Data Service can be used as an alternative to writing an Apex controller in scenarios where you simply wish to create, read, update, or delete a record. You can consider Data Service's role much like the role of the standard controller in Visualforce, but instead, it exists in the client tier and is interacted with by code in the client controller.

Some of the benefits of using Lightning Data Service are listed here:

  • Data caching and optimization: Data is cached on the client side, thus reducing network traffic, which improves performance and data usage for mobile applications.
  • Data consistency: Data is shared by other components when making updates so that the user interface is always showing the correct information to the user, regardless of whether it was rendered using a Salesforce component or one of your own.
  • Security: Record data is filtered automatically based on the user's record-sharing rules, object, and field access. 
  • Advanced input forms: When used in combination with lightning-edit-form, lightning-view-form, and lightning-form, you can create custom forms that are tightly bound to the field definition in order to render the correct field type and label.
Be careful not to allow such client-side facilities to allow business logic to leak into the client tier. In all but the simplest cases, you will likely still want to delegate to an Apex service to perform business logic. Also, keep in mind the transactional scope; multiple updates from the client will each have their own transaction.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157