0

I have added the lightning component in lightning record page .I want to dynamically get the object name and its field value . I am able to get the object name but when i try to get the field value it is empty. Without querying with the record id is it possible to get the corresponding object field value.

Component :

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName">
<aura:attribute name="recordId" type="String" />
<aura:attribute name="sObjectName" type="sObject" />

<aura:if isTrue="{!v.sObjectName=='Account'}">
    {!v.sObjectName}
  {!v.sObjectName.Status__c}
</aura:if>
 <aura:if isTrue="{!v.sObjectName=='Contact'}">
    {!v.sObjectName}
  {!v.sObjectName.Phone__c}
</aura:if>

1

1 Answer 1

0

No, you have to query a record to see its values. The most common way to do this with force:hasRecordId is to use force:recordData to load the values from the database and/or the local record cache, if the record has already been previously loaded.

You must log in to answer this question.

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