0

I have been practicing the examples given in Lightning developes Guide and the topic is Display Record Data in a Custom User Interface Using force:recordData

I copied and pasted the below code Loading a Record but no output is getting displayed.

<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}"
  targetFields="{!v.simpleRecord}"
  targetError="{!v.recordError}"
  recordUpdated="{!c.handleRecordUpdated}"
  />

<!-- Display a lightning card with details about the record -->
<div class="Record Details"> 
<lightning:card iconName="standard:account" title="{!v.simpleRecord.Name}" >
    <div class="slds-p-horizontal--small">
        <p class="slds-text-heading--small">
            <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></p>
        <p class="slds-text-heading--small">
            <lightning:formattedText title="Billing State" value="{!v.simpleRecord.BillingState}" /></p>
    </div>
</lightning:card>
</div>

<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
    <div class="recordError">
        {!v.recordError}</div>
</aura:if>

1
  • Please help me in this. Thanks in advance. Oct 14, 2019 at 13:09

1 Answer 1

1

You need to specify the fields to load or the layout mode. Add the following to force:recordData:

layoutType="FULL"
3
  • Thanks for your prompt response. I tried adding the suggested field (layout="FULL") under force:recordData but it displayed the below error if am using layoutType="FULL" it again shows the same blank page as earlier. Oct 15, 2019 at 4:59
  • Failed to save DisplayRecordExample.cmp: The attribute "layout" was not found on the COMPONENT markup://force:recordData: Source Oct 15, 2019 at 4:59
  • @MAYANKSINGH Sorry, it should have been layoutType="FULL". I have updated the answer.
    – sfdcfox
    Oct 15, 2019 at 10:25

Not the answer you're looking for? Browse other questions tagged .