You need to sign in to do that
Don't have an account?

How is "Lightning Data Service "know which record from "record id"?
How is "Lightning Data Service "know which record from "record id"?
Does "record id" included "record type"?
Code reference only record id, not record type
and
Can I skip targetRecord?
Can I just using targetFields?
Does "record id" included "record type"?
Code reference only record id, not record type
<aura:component implements="flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader, force:hasRecordId"> <aura:attribute name="record" type="Object"/> <aura:attribute name="simpleRecord" type="Object"/> <aura:attribute name="recordError" type="String"/> <force:recordData aura:id="recordLoader" recordId="{!v.recordId}" layoutType="FULL" targetRecord="{!v.record}" targetFields="{!v.simpleRecord}" targetError="{!v.recordError}" recordUpdated="{!c.handleRecordUpdated}" /> <!-- Display a header with details about the record --> <div class="slds-page-header" role="banner"> <p class="slds-text-heading_label">{!v.simpleRecord.Name}</p> <h1 class="slds-page-header__title slds-m-right_small slds-truncate slds-align-left">{!v.simpleRecord.BillingCity}, {!v.simpleRecord.BillingState}</h1> </div> <!-- Display Lightning Data Service errors, if any --> <aura:if isTrue="{!not(empty(v.recordError))}"> <div class="recordError"> <ui:message title="Error" severity="error" closable="true"> {!v.recordError} </ui:message> </div> </aura:if> </aura:component>
and
Can I skip targetRecord?
Can I just using targetFields?
Hi,
The thing about using Lightning Data Service is that when we are using "force:hasRecordId", the component automatically fetches the recordID of record on whose layout it is on.
Q. Does "record id" included "record type"?
A. No, the record id only contains the recordID of the record but you can perform a SQOL to get the recordtype Id of that record.
Q.Can I skip targetRecord?
Can I just using targetFields?
A. Yes, you can skip the targetrecord, it works. But it isn't considered as a best practice.
targetRecord is populated with the loaded record.
targetFields is populated with the simplified view of the loaded record.
v.targetFields.Name is equivalent to v.targetRecord.fields.Name.value. Therefore for easy dereferencing of object properties we use v.targetfields.
Let me know if this helps.
Thanks!
All Answers
Through the record id, you can find the object and once you know the object name you can extract the fields .
Hi,
The thing about using Lightning Data Service is that when we are using "force:hasRecordId", the component automatically fetches the recordID of record on whose layout it is on.
Q. Does "record id" included "record type"?
A. No, the record id only contains the recordID of the record but you can perform a SQOL to get the recordtype Id of that record.
Q.Can I skip targetRecord?
Can I just using targetFields?
A. Yes, you can skip the targetrecord, it works. But it isn't considered as a best practice.
targetRecord is populated with the loaded record.
targetFields is populated with the simplified view of the loaded record.
v.targetFields.Name is equivalent to v.targetRecord.fields.Name.value. Therefore for easy dereferencing of object properties we use v.targetfields.
Let me know if this helps.
Thanks!