Get a Quote

Hey, do you want to share your amazing ideas with us, drop your requirements, we are keen to work with you on your fantastic project. We will try to reach you shortly, SEE YOU !

Tell us about you

Tell us about your Project

How To Use Lightning Data Service In LWC In Salesforce

In this blog, we will learn about lightning data service and use in LWC. Basically every web component needs server call to show data. Now if we are taking the traditional approach suppose we have 3 components in a page and all are showing data about Account.
component apex controller
Now we can see in a single page for the same data there is three apex call and the database will be accessed three times. If data changes by component 1 it will reflect new data while others will have no information about this so they will keep showing the old date. Definitely you don’t want this. So after knowing all this issue we will be happy if we can get a middle man who can fetch data from Salesforce, cached it at his end, and send the data to all components. Also if it can notify all components for any change in data.

So here comes LDS for rescue.component lightning data service

How Beneficial

  • No need to write Apex Code or SOQL query
  • Support most standard and all custom object
  • Reduce server load, database load, and network transfer by fetching data once.
  • Share cache data across components
  • Support field level security and sharing rules so no need to worry about data security and visibility
  • Support CRUD operations
  • Supports offline in Salesforce1
  • Can use in aura as well as LWC


hire salesforce developers

How To Use In LWC?

You can use it in LWC by importing UI API.


After importing this you can use wire adapters and functions.

Also, you can use components like
lightning-record-edit-form, lightning-record-form, and lightning-record-view-form

You can also call your custom APEX controller as

I hope this blog will give a basic understanding of LDS. In the next blog, we will learn record fetching by UI API.

Also Read: How To Use Dynamic Styling In LWC In Salesforce and How To Call Apex Method In Lightning Web Components

author profile
About Author
Author Name:
Virendra Sharma

Certified Magento 2 Consultant

Author Bio:

Virendra Sharma is an ecommerce tech-enthusiast and certified Magento Developer. With a decade of experience in Magento ecommerce development, he has been assisting ecommerce businesses across the globe to harness Magento capabilities by developing, maintaining, and improving clients’ eCommerce websites. A leader in his own rights his teammates see him as an avid researcher and a Magento evangelist.

About Emizentech:

An acclaimed IT solution provider and a leading Magento 2 development company with its expertise lies in delivering top of the line ecommerce solutions, Salesforce commerce cloud services, mobile app development and many more verticals.

Develop Car Buy Sell App
06 Jul, 2020

Car Buy-Sell Mobile App Development - Cost & Features

Technology has changed the shopping habits and the needs of the customers. It has changed the way people have started […]
Read more
Mobile App Development
Convert Ecommerce Store to Mobile Commerce App
03 Jul, 2020

Why Convert Your Ecommerce Store To Mobile Commerce App

While running towards success, an eCommerce business everyone just dreams about living in the heart of the audience and ruling […]
Read more
Ecommerce Development
On Demand Laundry Mobile App Development Cost & Features
02 Jul, 2020

On-Demand Laundry Mobile App Development - Cost and Features

Home services, handyman services, food, and cab services are amongst the greatest beneficiaries of the evolving on-demand economy. Whether it […]
Read more
Mobile App Development

Let’s Talk Business

Reach out to us by following below given details, or simply drop us a text to start a conversation, we are here to provide best in class business solutions.