• Pedro Loaiza 5
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

I'm trying to recreate the standard Related Record component that we have available in lightning since it's not functioning properly for Person Accounts. The component should display information of the related Account when a user is working on a Case. I thought it would be a good idea to make a lightning:recordViewForm component and diplay all the fields as lightning:outputFields. 

Actually creating the layout shouldnt be a problem. I'm having trouble getting to the AccountId and placing it in the recordId attribute. My code so far:
<aura:component implements="flexipage:availableForAllPageTypes, force:hasRecordId" access="global">

    <lightning:recordViewForm recordId="???" objectApiName="Account">
        <div class="slds-box slds-theme_default">
            <lightning:outputField fieldName="Name" />
            <lightning:outputField fieldName="Phone"/>
            <lightning:outputField fieldName="PersonEmail" />
            <lightning:outputField fieldName="PersonBirthdate" />
        </div>
    </lightning:recordViewForm>
    
</aura:component>
I guess I should use force:recordData somehow but don't know enough about lightning components to get this to work. Help is much appriciated!

Thanks!