26

After doing some testing, I can say that this is very inefficient. Loading more than about 6 records caused a separate loading to occur. While the system did not crash, as I hypothesized originally in my comment, the total loading time was incredibly large. For about 800 records, it took over 20 seconds to load, about 40 records per second. And this was for ...


23

ok - reloadRecord takes 2 undocumented arguments reloadRecord(skipCache, callback) so you can just do a cmp.find('recordData').reloadRecord(true) on init, or whenever you need.


12

added based on comments It seems there is a bug for importing geolocation fields (able to import other compound fields like BillingCity). So, we can use direct string notation as below. Geolocation type fields are Compound Fields (like BillingAddress). Two main points to be highlighted from docs is : Geolocation is a compound field that counts toward ...


10

The data you get from wire service is in the form as below: { "apiName": "Account", "childRelationships": { }, "fields": { "Name": { "displayValue": null, "value": "University of Boston" }, "POC_Datetime__c": { "displayValue": "8/7/2019 8:02 PM", "value": "2019-08-08T03:02:37.000Z" }, "Phone": { "...


9

While working with "force:recordData" and if you want to get the values in the lightning controller you have to use the standard attribute of the "force:recordData" i.e; "recordUpdated". Please have a look at this sample code. <force:recordData aura:id="recordLoader" recordId="{!v.recordId}" targetFields="{!v.simpleRecord}" targetError="{!v....


8

This change was introduced when the Dataservice was out from pilot .Using the targetRecord the syntax was too longer and the targetFields simplified it further .Recommend using targetFields and you can drop the tragetRecord .targetRecord is kept only for backward compatibility reasons .


7

There is some description of targetFields in the Lightning Data Service (Beta) release notes: force:recordData includes a new attribute called targetFields, which is populated with a simplified view of the record’s fields. targetFields is automatically updated whenever Lightning Data Service detects a record change. v.targetFields.Name is equivalent ...


7

A Lightning Data Service record will only update on-screen if the record is edited/updated in another Lightning Data Service context. So, assuming that the database change is not done by the same user, I would suggest using Streaming API, or an on-screen polling mechanism that does calls to APEX.


7

What I feel here is in force:recordData the reloadRecord method when called is not doing a server round-trip to fetch new values. It's displaying the stale value from local cache. From SF docs of reloadRecord method Performs the same load function as on init, using current config values (recordId, layoutType, mode, etc) but does not force a server ...


7

Access Internalization Properties import { LightningElement } from ‘lwc’; import TIME_ZONE from '@salesforce/i18n/timeZone'; export default class Example extends LightningElement { const timeZone = TIME_ZONE; }


6

The biggest advantage of the LDS to me are below which avoids some apex code 1.Not having to write code to check for CRUD/FLS in LDS .In apex you would end up writing this yourself .This will lead to consuming more CPU limits , deployment time and additional support cost . 2.Not having to write test classes .In apex you will end up needing test code . 3....


6

We understand that the ergonomics from a declarative point of view are great, but unfortunately there are big performance penalties and a bunch of quirks and functional issues supporting dynamic evaluation of expressions (ex. what would happen if you were to mutate the binding (bidirectional) in the children? - it will be very hard to mutate the object back ...


5

Edit: lightning:input has label and name as required attribute. <lightning:input aura:id="boatRevw" label="Title" name="Title" value="{!v.boatReview.Name}"/> Your boatReview attribute is null. You need to assign a default value to it as I guess you want to take fresh input and not displaying data from server in edit mode. <...


5

You should be able to get the contact information using targetField attribute, below is sample working code. <aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId"> <!--inherit recordId attribute--> <aura:attribute name="record" type="Object" description="The record object to be displayed"/> <aura:attribute ...


5

You're updating Boolean field with text component.set("v.simpleRecord.field1", "true"); It should be like this: component.set("v.simpleRecord.field1", true);


5

Your option 2, using lightning:recordForm, is the solution. You just need to update your submit handler code. In your cmp: <lightning:recordForm aura:id="form" recordId = "{! v.recordId}" fields = "{!v.fields}" objectApiName="Account" layoutType="Full" columns = "2" mode = "Edit" onload = "{!c.handleLoad}" ...


5

You'll want to look at this answer regarding force:recordData performance, which lightning:recordViewForm depends on. Basically, doing this is going to generate a ton of traffic and perform very poorly if you're dealing with more than about six records. So, if you expect to have only a handful of records, knock yourself out and use the lightning:record* ...


5

Converting from LWC wire format to AuraEnabled format would probably look something like the following: let record = { ...Object.keys(data.fields).reduce((a,f)=>a[f]=data.fields[f].value,{}), sobjectType: data.apiName }; To fully understand this, you'll want to read about ... (the spread operator), Object.keys, and arrow functions. We need to do ...


4

I haven't used LDS yet to replace Apex code, or for inserting/updating records. But an incredibly useful ability I found is using LDS to monitor for updates to records and then acting upon that update. For example, I have one component that presents multiple records in kanban type view. I use an aura:iteration to create an LDS instance for each record, ...


4

Please follow the Salesforce documentation for force:recordData. As per the documentation "To perform tasks beyond rerendering the record when the record changes, handle the recordUpdated event. You can handle record loaded, updated, and deleted changes, applying different actions to each change type." In your case invoke your other function once ...


4

Any call to the server is inherently asynchronous: the browser issues a request to the network, the request traverses the network, the server processes the request and issues a response, the response traverses the network, and the client processes the response. In contrast the component init event is fired synchronously when the component is created. This ...


4

You will necessarily want to use Apex Code. Even though one could use the Lightning Data Service to update those records, it is intended to be used only on record at a time, so, especially in mass updates, you would have very poor performance. For example, editing 50 records with an Apex Code controller would result in a fraction of a second for saving, but ...


4

you could use a notequals operator, a quick look at the Expression Functions Reference might shed some light on the approach, but a quick example: isTrue="{!and(notequals(v.theField, 'some value')... or equals, if you reverse the logic.


4

You are using the compound field Address. Instead use individual Fields mentioned in the Salesforce Field Reference Guide in your fields attribute for the force:recordData Street City (etc...) I haven't tried using your example but this is a working example from my dev org just for you. <aura:attribute name="record" type="Object"/> <aura:...


4

No. LDS - lightning/uiRecordApi, lightning-record-form, lightning-record-edit-form and lightning-record-view-form - are all based for only 1 record . For simplicity you can write custom apex utils method which accepts parameters like list of fields, object name, query filters etc which can return both SOQL or SOSL query results. This can be a starting ...


3

Yes, there will be a minor delay, since the fields must be fetched from the server. There's nothing you can do to avoid this delay. The delay should usually be less than a small fraction of a second, enough to be noticeable, but not by much.


3

var recId = result.recordId; result is not defined? you must declare your result variable: var result = something. So, I am guessing you should get the response as follows: var result = saveResult.getResponse().SOMETHING; After updating your post, the server response is actually in your saveResult variable, in order to fetch the recordId from it, just ...


3

This is a common mistake, when you declare your function function(component, event, helper) you need to use the same parameter names. We can see in your code that you are using cmp when attemtping to set an attribute value cmp.set("v.recordSaveError"..... either pass cmp as a parameter or change all your cmp's to component. E.g. function(cmp, ...


3

Name:- The contact’s combined first name, middle name, last name, and suffix, as displayed on the contact detail page. Lightning:RecordEditForm inherit the property of the field, it will show the field in their datatype whereas all the fields in Force:RecordData will be shown as Text field. Instead of using FirstName, LastName separately and go for ...


3

Why not completely remove the and condition in your second aura:if and do something like so: <aura:if isTrue="{!v.eventsSimple.Event_Closed__c}"> <div style="background-color: red; font-weight: bold; color: white;"> This event is closed. </div> <aura:set attribute="else"> <aura:if ...


Only top voted, non community-wiki answers of a minimum length are eligible