What is Lightning Data Service?

Lightning Data Service is the preferred (and easiest) way to work with Salesforce data. With Lightning Data Service, developers use JavaScript to connect components to Salesforce data.

Lightning Data Service also provides security by making server calls to secure User Interface API endpoints. Using a client-side shared cache across all components, Lightning Data Service maximizes performance. When a record is cached, it’s retrieved from the cache, eliminating unnecessary calls to the server.

Lightning Data Service maintains consistent, up-to-date data across multiple components and clients throughout the app lifecycle. If several components use Lightning Data Service to work with a record, and one of them updates the record, the other components automatically reflect that update.

Below are 3 base Lightning components built on Lightning Data Service (LDS)

lightning-record-form


Use the lightning-record-form component to quickly create forms to add, view, or update a record.
Using this component to create record forms is easier than building forms manually with lightning-record-edit-form or lightning-record-view-form.

lightning-record-view-form


Use the lightning-record-view-form component to create a form that displays Salesforce record data for specified fields associated with that record. The fields are rendered with their labels and current values as read-only.

lightning-record-edit-form


Use the lightning-record-edit-form component to create a form that’s used to add a Salesforce record or update fields in an existing record on an object. The component displays fields with their labels and the current values and enables you to edit their values.

Scroll to Top