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 tried this using LDS, but with no luck.
What's the best approach for this scenario.
I am attaching my Component and Controller:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader"
access="global">
<aura:attribute name="isOpen" type="boolean" default="false"/>
<aura:attribute name="recordError" type="String"/>
<aura:attribute name="recordInfo" type="Object" />
<aura:attribute name="recordId" type="String"/>
<aura:attribute name="simpleRecord" type="Object"/>
<aura:attribute name="curView" type="String" />
<force:recordData aura:id="recordLoaderId"
layoutType="FULL"
recordId="{!v.recordId}"
targetRecord="{!v.recordInfo}"
targetError="{!v.recordError}"
targetFields="{!v.simpleRecord}"
mode="VIEW"
/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div class="slds-text-body_regular slds-text-align_center">
<lightning:formattedText title="text" value="{!v.simpleRecord.Name}" /> <!--DISPLAYING THE VALUE HERE-->
</div>
<!--<aura:attribute name="recordId" type="Id"/> -->
({
doInit : function(component, event, helper) {
console.log('insidde init:::');
console.log("account id:::::" + component.get("v.recordId"));
console.log("account id:::::" + component.get("v.simpleRecord")); //GETTING NULL VALUE HERE
console.log("account id:::::" + component.get("v.recordInfo"));
}})