+ Start a Discussion
Gautam_KasukhelaGautam_Kasukhela 

Lightning Data Service Data Load Account Data Issue

I am trying to load a lightning card with data from 4 fields of the Account object using "force:recordData" .
I see only one field's data i.e. of the 'Name' field. Following is a code of my component:-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	
    <aura:attribute name ="record" type="Object"
                    description="the record object to be displayed"/>
    <aura:attribute name="simpleRecord" type ="Object"
                    description="simplified view record object to be displayed."/>
    <aura:attribute name="recordError" type="String" 
  					description="An error message bound to force:recordData"/>
    <force:recordData 	aura:id="record"
    					layoutType="FULL"
                        recordId="{!v.recordId}"
                        targetError="{!v.recordError}"
                        targetRecord="{!v.record}"
                        targetFields ="{!v.simpleRecord}"
                        mode="VIEW"/>
    <!-- Use the Lightning Data Service to populate the data-->
    <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="Annual Revenue" value="{!v.simpleRecord.AnnualRevenue}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Number of Employees" value="{!v.simpleRecord.NumberOfEmployees}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></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>
                                 
    
    
</aura:component>
What am I missing here that is resulting in a page like the below:-
I am using an Admin profile and I have validated that the fields have data and is accessible for this profile.

User-added image
 
Best Answer chosen by Gautam_Kasukhela
Raj VakatiRaj Vakati
The issue with lightning:formattedText which used to display number fileds. The correct code is here below 

 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name ="record" type="Object"
                    description="the record object to be displayed"/>
    <aura:attribute name="simpleRecord" type ="Object"
                    description="simplified view record object to be displayed."/>
    <aura:attribute name="recordError" type="String" 
                    description="An error message bound to force:recordData"/>
    <force:recordData 	aura:id="record"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordError}"
                      targetRecord="{!v.record}"
                      targetFields ="{!v.simpleRecord}"
                      mode="VIEW"/>
    <!-- Use the Lightning Data Service to populate the data-->
    <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:formattedNumber  title="Annual Revenue" value="{!v.simpleRecord.AnnualRevenue}" /></p>
                <p class="slds-text-heading--small">
                    <lightning:formattedNumber  title="Number of Employees" value="{!v.simpleRecord.NumberOfEmployees}" /></p>
                <p class="slds-text-heading--small">
                    <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></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>
    
    
    
</aura:component>

 

All Answers

Raj VakatiRaj Vakati
The issue with lightning:formattedText which used to display number fileds. The correct code is here below 

 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name ="record" type="Object"
                    description="the record object to be displayed"/>
    <aura:attribute name="simpleRecord" type ="Object"
                    description="simplified view record object to be displayed."/>
    <aura:attribute name="recordError" type="String" 
                    description="An error message bound to force:recordData"/>
    <force:recordData 	aura:id="record"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordError}"
                      targetRecord="{!v.record}"
                      targetFields ="{!v.simpleRecord}"
                      mode="VIEW"/>
    <!-- Use the Lightning Data Service to populate the data-->
    <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:formattedNumber  title="Annual Revenue" value="{!v.simpleRecord.AnnualRevenue}" /></p>
                <p class="slds-text-heading--small">
                    <lightning:formattedNumber  title="Number of Employees" value="{!v.simpleRecord.NumberOfEmployees}" /></p>
                <p class="slds-text-heading--small">
                    <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></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>
    
    
    
</aura:component>

 
This was selected as the best answer
Gautam_KasukhelaGautam_Kasukhela
Thank you Raj. That was indeed the issue.