Lightning Component:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global"> <!--Attributes--> <aura:attribute name="accFields" type="Account"/> <!--Component Start--> <!--Lightning Force Data to get Account record--> <force:recordData aura:id="accRecordData" layoutType="FULL" recordId="{!v.recordId}" targetFields="{!v.accFields}" recordUpdated="{!c.handleRecordUpdate}"/> <!--Component End--> </aura:component>
Lightning JS Controller:
({ handleRecordUpdate: function(component, event, helper) { var accountFields = component.get("v.accFields"); console.log('Account Name : '+ accountFields.Name); } })