Saturday, July 6, 2019

How To Access Salesforce Org Data in Lightning Web Components

In Classic if you want access/create the Salesforce Data we can either use some Standard Controllers or Custom controllers .Similar to Classic in Lighting Web Components also you can use two different ways to access/create the data into Salesforce objects or to show the Salesforce objects data in Lightning Web Components.

  1. Base Lightning Components
  2. Wire Services

Base Lightning Components:


These are the standard salesforce components which will be used to view the record,to edit the record and to view the record in read only mode.

Benefits:
  • Doesn't require apex code
  • Field labels are displayed based on org default
  • It's has built over Lighting UI API and Lightning Data Service API
  • It access models Static and Dynamically
  • Metadata Aware
  • Custom rendering of data
  • Custom layouts and multi column layouts



Wire Service:

Wire service will use Lighting /UI API Module and Lightning Data Service to fetch the data from the Salesforce Servers/Objects and to show it in the components.Basically we have to import the wire adapters into our lighting web components js file in order to build the communication between the components and servers.The results returned from the wire adapter will be stored either in property or function.

  • Lighting /UI API Module : It will contains bunch of wire adapters(small segment of code) and some JS APIs. These wire adapters will be used to fetch the data from the servers and these JS APIs if you want to modify this data or to push the data into servers.

  • Lightning Data Service : It will act an interface between the wire adapters and data base to get the data from the data base into the adapters. Basically adapters will interacts with Lightning Data Services to fetch the data from the data base.









 Hope this helps you...Enjoy!


No comments: