Add the following code to the component:
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<force:recordData aura:id="propertyRecord"
recordId="{!v.recordId}"
targetFields="{!v.property}"
layoutType="FULL" />
<lightning:card iconName="standard:user" title="{! 'Broker for ' + v.property.Name}">
<div class="slds-p-left_large slds-p-right_medium">
</div>
</lightning:card>
In the Developer Console, add the following code to the BrokerCard component on line 12:
<lightning:recordForm aura:id="brokerForm"
recordId="{!v.property.Broker__c}"
objectApiName="Broker__c"
layoutType="Full" />
Save the component and refresh the Property Record page.
In the Developer Console, add the following attribute to the lightning:recordForm
:
mode="View"
layoutType
of the recordForm to Compact
.In the Developer Console, add the following attribute to the component:
<aura:attribute name="brokerFields" type="String[]" default="Name,Title__c,Phone__c,Email__c" />
layoutType="Compact"
from the recordForm.Add the following to the recordForm:
fields="{!v.brokerFields}"
columns="2"
My component isn’t working! Check your code against the following:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<aura:attribute name="brokerFields" type="String[]" default="Name,Title__c,Phone__c,Email__c" />
<force:recordData aura:id="propertyRecord"
recordId="{!v.recordId}"
targetFields="{!v.property}"
layoutType="FULL" />
<lightning:card iconName="standard:user" title="{! 'Broker for ' + v.property.Name}">
<div class="slds-p-left_large slds-p-right_medium">
<lightning:recordForm aura:id="brokerForm"
recordId="{!v.property.Broker__c}"
objectApiName="Broker__c"
fields="{!v.brokerFields}"
columns="2"
mode="View" />
</div>
</lightning:card>
</aura:component>