I am using lightning:recordViewForm with lightning:outputField in my lightning component.

Regular fields are shown correctly, but when I am trying to show a field of a related parent record nothing is shown:

<lightning:recordViewForm recordId="a1IW0000001CGSbMAO" objectApiName="Budget__c">
    <lightning:outputField fieldName="Id" />
    <lightning:outputField fieldName="Name" />
    <lightning:outputField fieldName="Grant__c" />
    <lightning:outputField fieldName="Grant__r.Id" />

enter image description here

As you can see - fields on the Budget__c object display good, but the Id field on the parent Grant__c object, does not display at all.

Also - on chrome dev console I get this error:

Error: Field [Grant__r.Id] was not found

Is there something I am doing wrong or is that not supported?


2 Answers 2


I dont believe that the correct notation is Grant__r.Id check the api field name on the object ad use that instead.

form Master-detail relationships (even lookups) I dont believe what you are attempting is possible, you can only reference the field itself, not the fields of the relationship object, unlike when using the force:recordData component which uses the Lightning Data Service, versus the record:EditForm which uses the User Interface API

  • the api field name on the object is Grant__c, I tried Grant__c.Id and nothing has changed Nov 14, 2018 at 15:09
  • the field api name not the object, it has to be under budget.if not, you will have to create the field
    – glls
    Nov 14, 2018 at 15:10
  • This is a master detail field and it's api name is Grant__c - same as the object name Nov 14, 2018 at 15:11
  • in that case i dont think what you are attempting is possible, you can only reference the master field itself, not the fields of the relationship object.
    – glls
    Nov 14, 2018 at 15:13
  • 1
    @ItaiShmida lightning:recordEditForm is for editing a record; unlike force:recordData, you can't access parent or child fields at all. It's not supported, any more than it would be possible to edit an account on a default Account edit page.
    – sfdcfox
    Nov 14, 2018 at 15:23

Please try this answer. What I was doing is storing the budget record in a budget attribute then using "recordViewForm" to display parent fields.

Please comment if you have any questions:

<aura:attribute name="budget" type="Budget__c"  />
<aura:attribute name="recordId" type="Id"  />

<force:recordData aura:id="budgetRecord" recordId="a1IW0000001CGSbMAO" targetFields="{!v.budget}" layoutType="FULL" />
<lightning:recordViewForm recordId="{!v.budget.Grant__r.Id}" objectApiName="Grant__c">
 <lightning:outputField fieldName="Id" />
<lightning:outputField fieldName="Name" />                         


You must log in to answer this question.

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