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.

33 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
2answers
5k 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
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
2answers
3k 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
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
398 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
0answers
623 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
0answers
204 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 (...
2
votes
0answers
618 views

Lightning Data Service not showing Validation Rule Errors

As part of Salesforce's low code policy, I have been tasked to remove some apex code which simply updates a field within a try catch. If a validation rule occurs, it is caught and I process the result ...
1
vote
0answers
33 views

Lookup search modal not working for lightning-input-field component in lightning out for LWC

As visible in the screenshot below, The lightning-input-field component along with lightning-record-edit-form is used to generate this view. LWC is embedded inside the Visualforce page using the ...
1
vote
0answers
29 views

How to properly notify the data service of all modifications when imperative apex method is called from LWC

Per the documentation Refresh the Cache When Calling a Method Imperatively we need to notify the lightning data service that we used an imperative apex method to modify some records in order for it to ...
1
vote
1answer
394 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
166 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 ...
1
vote
0answers
442 views

Rollup Summary fields are not updated

We have built a custom lightning page showing account summary in the top and users can create income and expense (custom object) as child records to account. We have rollup summary fields on account ...
1
vote
1answer
348 views

__pc field is not showing force:recordData lightning data service

We have person account enabled org we are unable to get some formula fields and __pc fields through lightning data service we chaecked FLS and everything look correct other fields are coming but ...
1
vote
0answers
39 views

Lightning Data Service Interaction with Page Edit giving error

I have created a Lightning component to display nearBy accounts using Geolocation for a given Account. I am able to display a list of locations passing BillingLatitide and BillingLongitude from the ...
1
vote
2answers
2k views

Save Error - Undefined - Lightning data service

I am trying to save a record that a user creates using a form. I get a strange error description as "Undefined" which I do not understand. Below is my component, controller and helper class. The save ...
1
vote
0answers
113 views

Lightning Data Service support in Lightning Out

I am currently working on developing a new Lightning application and wanted to use Lightning Data Service. However I see from the Dev Guide (https://developer.salesforce.com/docs/atlas.en-us.210.0....
0
votes
1answer
18 views

Can I use uiRecordApi getRecord to get dynamically record?

Can I use uiRecordApi getRecord to get dynamically record? I am developing a custom lightning web component which can be placed on different record pages (Account, Contact, and Custom objects). I am ...
0
votes
0answers
39 views

Dynamic record editing with force:recordData and lightning:datatable inline edit

I'm trying to update a record using dynamically populated force:recordData but for some reason the edited values are not saved. I'm trying to chain reloadRecord and saveRecord because when not ...
0
votes
0answers
18 views

On view mode of an Aura CMP, If a field value present on the LDS CMP is updated the cmp should refresh on it own

I have a LDS form where on change of stage value we need to navigate to another Aura cmp (New CMP/JS controller code below). During the navigation, an API callout is made which updates '...
0
votes
2answers
29 views

Capture record update via LEX user interface inside custom Aura Component

I have a custom component used within the Utility Bar reflecting the context record field values (See below): <aura:component description="EC_RelatedTo" implements="force:...
0
votes
0answers
37 views

Refresh the page from the Lightning component

I am having the Lightning component that uses the Lightning Data Services to update the fields on the Case record, it works fine if the component is updating fields like status or origin like that. ...
0
votes
0answers
23 views

Replace the Lightning Components which uses Apex to Lightning Data Service

I currently have the lightning component which updates some of the fields on the Case record and also inserts the Case Comment and associates to the case where the fields are updated through the Apex ...
0
votes
0answers
35 views

force:recordData not returning the callback when executing from mobile

I'm having a lightning component which works in desktop web browser and S1 mobile app. I'm having the following snippet in the component JS: component.find("recordHandler").saveRecord( $...
0
votes
0answers
26 views

Lightning component is not updating the field

I am trying to make use of LDS in the lightning component to change the status of the case like below <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" ...
0
votes
0answers
187 views

Get fields from Lookup object using LDS (Lightning Data Service)

Suppose I have two custom objects: Property and Broker. Property has a lookup field to Broker. Suppose now I need to create a custom aura component inside a property record page that shows only the ...
0
votes
0answers
658 views

LWC: How create/edit record with fields displayed depending on the values ​of these fields

How create/edit record with fields displayed (hide/show) depending on the values ​​of adjacent fields? What are the best practice for that case? Thank you! For example: HTML <template if:true={...
0
votes
0answers
41 views

Unable to read SObject in LWC

I have a problem which I think could be an LWC bug. I need to pass an object, in this case a contract, which I get from @wire getRecord: have seen that there is a similar thread, which reports ...
0
votes
1answer
756 views

Using Lightning Data Service not able to save custom lookup field on record creation

Below is Lighting Component <force:recordData aura:id="RecordCreator" recordId="{!v.recordId}" layoutType="FULL" targetRecord="{!...
0
votes
1answer
287 views

Are Address fields are restricted to save in LDS?

Am writing lightning component on quote object for Billing Address using LDS. API Name(standard field) - BillingAddress I have an ui:inputSelect for BillingCountry and trying to save like below, ...
0
votes
1answer
2k views

How to use standard layout with force:recordData?

I'm trying to use the force:recordData to clone a record with some fields changed in the backend. I am able to retrieve it to the front-end. But unfortunately it seems force:recordData doesn't refresh ...
0
votes
1answer
1k views

Trailhead “Build a Lightning Component to Override a Standard Action” - “Use Lightning Data Service”

I am stuck at the Trailhead: "Build a Lightning Component to Override a Standard Action" - "Use Lightning Data Service" with the error: "Challenge Not yet complete... here's what's wrong: The ...
0
votes
0answers
466 views

Unable to fire custom event in Lightning Data Service saveRecord callback function

I'm trying to fire a custom event in a child component to notify the parent that a case record has been saved and that it should perform an appropriate action. I'm finding that inside the saveRecord ...