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
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 ...
2
votes
1answer
147 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
1answer
570 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. ...
3
votes
2answers
475 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:...
5
votes
1answer
231 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 ...
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 ...
0
votes
1answer
92 views

What are the similarities/differences between force:recordData attributes

I've just completed a few Lightning Component Trailhead modules and the last one discussed the Lightning Data Service which introduces <force:recordData ... />. For some examples, they use ...
3
votes
1answer
328 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 ...
1
vote
0answers
552 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
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
1answer
288 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"...
0
votes
1answer
190 views

Retrieve Community Contact fields in force:recordData

Is there a way to retrieve Community user's contact fields in force:recordData? This is my first lightning coming, and I'm not finding proper information on this. I'm trying to display the logged in ...
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 ...
1
vote
1answer
679 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
617 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 ...
3
votes
0answers
595 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 ...
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....
1
vote
1answer
494 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="...
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....
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 ...
0
votes
1answer
2k views

lightning:recordViewForm delay loading data

Is this common that field data loading in lightning:recordViewForm is having bit delay? Is there a way we can avoid this delay? <force:recordData recordId="{!v.recordId}" ...
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 ...
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 ...
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 ...
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 ...
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
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 ...
0
votes
1answer
1k views

Lightning Data Service, insert new record then clear and insert another

I am trying to use Lightning Data Service, force:recordData, with a component to insert new records. It successfully inserts one but then I want to clear the text and be able to insert another. Is LDS ...
0
votes
3answers
645 views

navigateTo : New record

I have replaced the standard "New" functionality on a custom object, and I want to navigate to the newly created record after save. I have looked at the developer documentation, and I get that I need ...
1
vote
0answers
109 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
2k views

Problem saving record with Lightning Data Service, $A.getCallback() error

ReferenceError: Error in $A.getCallback() [cmp is not defined] Callback failed: serviceComponent://ui.force.components.controllers.recordGlobalValueProvider.RecordGvpController/ACTION$saveRecord I ...
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?
0
votes
2answers
2k views

Trailhead challenge passed but unable to use the edit component

From the Manipulate Records with force:recordData module https://trailhead.salesforce.com/modules/lightning_data_service/units/lightning_data_service_manipulate_records, I passed the challenge using ...
1
vote
1answer
591 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 ...
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 ...
0
votes
1answer
963 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
1answer
567 views

Can you nest a lightning data service component inside a parent component?

I've read the component developer guide regarding data service components, but I'm not sure if nesting is supported. I am getting the following error when a data service component is a child, but it ...
0
votes
0answers
439 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 ...
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 ...

1
2