Questions tagged [lightning-data-service]

Questions relating to the Lightning Data Service. Lightning Data Service is a service provided by Salesforce to streamline data access in aura components and lightning web components.

Filter by
Sorted by
Tagged with
17
votes
1answer
7k views

Forcing a refresh in force:recordData

force:recordPreview had a ignoreExistingAction attribute that would force a server trip. I have an issue right now where I have two components: Comp A - Contains a list of sObjects, saves/updates ...
16
votes
1answer
4k views

How efficient is Lightning Data Service when working with multiple records?

I've seen quite a few Lightning Data Services posts pop up recently. This question used it to work on a set of records as opposed to a single record. The way it was coded had me worried thinking that ...
13
votes
2answers
7k views

Dynamic field binding in Lightning (e.g. lightning:input)

This is to me the most restricting drawback of Lightning compared to Visualforce. A way to dynamically bind/access properties like values of fields. To make complex component structures fast I don't ...
8
votes
4answers
1k views

“Unable to read Sobject” when passing LWC getRecord data to Apex

I am using the LWC Data service to get query an Account already in the component via @track record; @wire(getRecord, { recordId: "$recordId", fields: ...}) setRecord({error, data}) { // Need to ...
8
votes
1answer
2k views

Show form with page layouts && intercept save … Lightning:recordForm / force:recordData

Somewhat flummoxed with this lightning component. The use case is simple: Intercept the save event on a record edit, grab the new field values and do 'stuff' before saving the record. Example User ...
7
votes
2answers
2k views

Practical Use of Lightning Data Service

From the trailhead/docs I understand LDS is similar to Standard Controllers. I followed this example given in the docs to understand more about it. https://developer.salesforce.com/docs/atlas.en-us....
7
votes
1answer
3k views

Get records in Lightning web components without APEX

import { LightningElement, track, api, wire } from 'lwc'; import { getRecord } from 'lightning/uiRecordApi'; const FIELDS_SOLICITUD = [ 'DCABM_obj_solicitudABM__c.DCABM_fld_aplicacionSolicitud__c'...
5
votes
1answer
234 views

Is it prudent to use force:recordData (and similar) within aura:iteration?

The aura framework and lightning:recordData currently (Summer 18) support only single object retrieval. Let's assume I got a listItem.cmp into which I wired force:recordData in VIEW mode or a ...
5
votes
0answers
98 views

Stub Lightning Data Service response in Lightning Test Service (Jasmine)

Using Jasmine I can simply stub response as this before $T.createComponent: $A.enqueueAction = jasmine.createSpy().and.callFake((action) => { var cb = action.getCallback("SUCCESS") cb.fn....
4
votes
3answers
3k views

confused on force:recordData!

while I'm going through the tutorial on Lightning Data Service, I can see that they use force:record data to perform all the CRUD operation and eliminate the need to write apex controller. but I did ...
4
votes
2answers
8k views

Lightning Data Service - Get record value during Component Initialization in Controller

I have a quick action in Account object which loads a Lightning Component. I need to get the record values during initialization (in the doInit function) in the JS Controller without using Apex. I ...
4
votes
1answer
638 views

Lightning Data Service - Dynamic Fields

I am creating a dynamic navigation (button) component to be used throughout the org. I am trying to provide system admins the ability to specify the data (field/fields) to be retrieved by the force:...
4
votes
2answers
2k views

force:recordData “recordUpdated”: Detect Trigger/Workflow Changes

I'm using Lightning Data Service in a component. It all works well. One item I've noted is that it does not seem to detect changes to fields which may have occurred via a trigger or workflow after a ...
4
votes
1answer
1k views

Unable to save a record using LDS

I use lightning data service method SaveRecord to create a record of type BoatReview__c. The boatReview__c object has following fields: I only populate Name and comment__C field using a form on my ...
3
votes
2answers
604 views

Retrieving Geolocation fields from a Lightning web component using getRecord()

I am attempting to retrieve the value of a Geolocation field in a Lightning web component by using wire service with the uiRecordApi's getRecord() method. I can import the compound field or its ...
3
votes
2answers
479 views

How to use v.sObjectName to define fields in Lightning Data Service

To use my Lightning component for record pages of multiple types I need to load the record in a generic fashion. <aura:component controller="MyCtrl" implements="force:hasRecordId,force:...
3
votes
0answers
45 views

Why does Lightning Data Service fails quietly when trying to load converted lead?

I was hoping to make subsequent request by picking up ConvertedAccountId, ConvertedOpportunityId, etc, but seems that is not possible - will I have to fallback to Apex? Is that expected behaviour? ...
3
votes
1answer
331 views

lightning:recordEditForm Account Name binding issue in salesforce person account orgs

I run into a issue when using lightning:recordEditForm to together Account Name info in an org where Salesforce Person Account is turned on. I was trying to bind to a business account and edit the ...
3
votes
2answers
2k views

How to use force:recordData to clone a record?

I'm trying to clone an Opportunity record with certain values changed. Below is my code (component will be launched from Lightning component action). My Component Markup <aura:component ...
3
votes
0answers
598 views

Lightning Data Service not updating field

I am having 2 issues. One is, when I am updating a field, there are some field validations that are not getting flagged in my code. The second is when I have met the criteria, the field does not ...
2
votes
1answer
235 views

Lightning Data Services vs. Streaming API

I have a lightning component which needs to be refreshed when a record is changed in the database. Can I use lightning Data Services or must I use the Streaming API?
2
votes
2answers
8k views

Lightning Data Service: aura:if NOT condition

I am writing a new Lightning Component to conditionally render a message based on a few field values. I am close to having the conditions render like I want, but I can't figure out how to write in a ...
2
votes
1answer
4k views

Lightning Data Service display related records

I am trying to display Contact details on a Lightning Data Service component on the Case Level. An example SOQL query that is working is Select ContactId, Contact.FirstName, Contact.LastName from ...
2
votes
1answer
574 views

LWC: Get UserInfo using Lightning Data Service

I am playing around with Lightning Web Components and I was wondering if there is a way to pull the UserInfo.getTimeZone() using Lightning Data Service? I was thinking along the lines of: import ...
2
votes
1answer
572 views

Editable lightning:datatable with Lightning Data Service?

Its it possible to rig up editable lightning:datatable to do saves via lightning data service? In the few samples (very few) saves requests are sent to an APEX controller that you need to write. ...
2
votes
3answers
694 views

Lightning data service - Edit mode & Spring'18 “new feature”

I have components written during Winter'18. After the rollout of Spring'18 preview they stopped working. The components fetch fields (either via layoutType=FULL or mentioned by name) that happen to be ...
2
votes
1answer
1k views

lightning:recordEditForm not working without force:recordData

The recordEditForm is not supposed to need the Lightning data service provided by recordData however in the below example the only time fields beyond the first one show up are if I also include the ...
2
votes
1answer
149 views

How to deal with users without permission while using Lightning Data Services?

To be more specific, I have the following scenario that just happened: I developed a component on a sandbox (development environment). This component uses force:recordData to retrieve some field data ...
2
votes
2answers
1k views

Must Lightning Data Service always respect running user's object/field access?

For simple component work, I prefer to use Lightning Data Service as opposed to @AuraEnabled Apex. And while I have not seen this documented, it appears that the Lightning Data Service always ...
2
votes
0answers
136 views

Lightning Knowledge component is not refreshed when the case changed programatically

In the detail page below, the standard Knowledge component is properly refreshed when I change the "Verbatim (English Language)" field through the UI. However, if I change the value of "Verbatim (...
1
vote
2answers
2k views

Reload Lightning Data Service after updating the record on the server

I have a parent component that uses lightning data service (lds) to get the record. This record is then shared to all of it's children as needed using data binding. I need to update the record using ...
1
vote
1answer
496 views

force:recordData - LDS

I am comng across an error that I am unsure how to solve. I am using force:recordData to update a field. Component <aura:attribute name="record" type="Object" /> <aura:attribute name="...
1
vote
1answer
12k views

$A.getCallback() [Cannot read property of null- Simple form

I keep getting $A.getCallback() [Cannot read property of null when I start typing in the text fields of a form. Before adding the default I have the component as below: <aura:component ...
1
vote
1answer
235 views

Is it possible to use Lightning Data Service to retrieve all records of a giving SObject and avoid writing a custom AuraEnabled method?

I'd like my LWC component to retrieve all records of an SObject type without having to create a custom AuraEnabled method using Lightning Data Services. Is this possible?
1
vote
1answer
680 views

Lightning Data Service TargetRecord on PageLoad

I'm trying to use Lightning Data Service to retrieve fields without Apex/SOQL but I'm receiving errors due to my targetRecord being null on a page load. I have a function in my JS controller which I'...
1
vote
2answers
591 views

When do you need to manually reload a lightning data service record?

I use lightning data service (lds) multiple times in different parts of my app. Each use of lds involves the same record. Do I need to manually reload it each time a change event is detected? So say ...
1
vote
1answer
788 views

How to add pick-list field while using LDS

I am not able to display the salutation pick-list field on the lightning component, I have tried lightning:recordEditForm and force:recordData Can someone please suggest the right path to show the ...
1
vote
2answers
619 views

Calling a lightning form/modal that is its own component

I'm building a lightning page using several lightning components and using lightning data service. I would like to keep components as reusable as possible. What I am trying to accomplish is when ...
1
vote
1answer
48 views

Replace Apex Class with the LDS in lightning component

We have a lightning component in the Case Record Page layout which changes the case record status to closed on click of it.The lightning components makes a call to the Apex Class and updates the ...
1
vote
1answer
194 views

Do you have to use the value returned from force:hasRecordId to use Lightning Data Service?

I've tried using the Id from a lookup field involving the record being view in my lightning component. I query this data in init, then set the returned value to theCase. <aura:component ...
1
vote
1answer
290 views

I'm unable to get private attribute from a component to use in force:recordData

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >     <aura:attribute name="boatReview" type="BoatReview__c" access="global"...
1
vote
3answers
121 views

Is Lightning Data Service dependent on a field being part of a Layout?

I have a component that drops into a record page sidebar (Lead or Contact). It uses LDS to pull data for the record, including the MobilePhone field. I'm noticing that if the MobilePhone field is ...
1
vote
3answers
473 views

lighting data service layout styling

I'm creating a set of components to override the standard view and edit actions on an object. I've explored using <lighting-record-form> and <lightning-record-view-form>/<lightning-...
1
vote
1answer
269 views

Lightning Data Service will not load record

I just refreshed my dev sandbox and my staging sandbox. In my dev, lightning data service is able to load the record. When I go into my staging environment, which is a partial copy sandbox, no record ...
1
vote
1answer
3k views

Lightning Data Service - Update Field on Button Click

I am new to lightning components and am trying to get a button in lightning to update a checkbox on a contact record(Send_to_IFS__c) when the button is clicked. Below is what i have but it is not ...
1
vote
1answer
578 views

Is it possible to use Lightning Data Services \ <force:recordData without sharing rules \ field level security?

It is possible to declare a Apex controller class as public without sharing class noSharing { } Is it possible to use Lightning Data Services <force:recordData Without sharing \ field level ...
1
vote
1answer
206 views

Add picklist to community based form using lightning data service

I've got two fields on a Contact that I want to ask on a separate page with some verbiage on it and for some reason, I cannot get any of the LDS record handlers to work properly. I thought I would be ...
1
vote
1answer
592 views

Can we save list of OpportunityLineItems using lightning data service <force:recordData?

I am trying to create multiple opportunity products and quotelineitems for respective opportunities and quote. I have already inserted the opportuity and quote using lightning data service. But I ...
1
vote
1answer
209 views

Multiple Dependent Wire getRecords

I'm fetching two custom objects in a LWC. Object A__c is the record page's object and is fetched by its $recordId. It has a lookup field which points to object B__c's Id. @track bId; @wire(getRecord,...
1
vote
0answers
133 views

Handling Success Save Event for LDS new record

I am trying to handle the success save event of LDS saveRecord method. I need only proper Id from the new record response. In DESKTOP it's working fine whereas in Mobile/Tablet i am getting improper ...