function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Natacha JosephNatacha Joseph 

lightning:outputField problem with lookup field

Hi !
I have my Lightning Component in which I display the values for my record.
I use the lightning:outputField to display my fields values, and for my lookup field there is no link.  I cannot click on my field name to get to the other object.  Is it the way it works ?  Is it a bug ?  And if it is a bug, how can I display my field value with a link my user can click ?

 Thanks !

Here is the code of my component
 
<aura:component implements="flexipage:availableForRecordHome" access="global" >
    <aura:attribute name="recordId" type="string" />
    
    <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="AGF_Proposal__c">

        <div class="slds-page-header__detail-row slds-section slds-is-open">
            <h3 class="slds-section__title slds-theme_shade">
                <span class="slds-truncate slds-p-horizontal_small" title="">Detail</span>
            </h3>
        </div>
        
        <lightning:layout horizontalAlign="space">
            <lightning:layoutItem class="slds-col slds-size--1-of-2">
                <lightning:outputField fieldName="AGF_Opportunity__c" />
                <lightning:outputField fieldName="AGF_Output_Language__c"/>
                <lightning:outputField fieldName="AGF_Discount__c" />
            </lightning:layoutItem>
            <lightning:layoutItem class="slds-col slds-size--1-of-2">
                <lightning:outputField fieldName="AGF_Status__c" />
                <lightning:outputField fieldName="AGF_Job_Start_Date__c" />
                <lightning:outputField fieldName="AGF_Alternative_proposal__c" />
            </lightning:layoutItem>
        </lightning:layout>
        
        <div class="slds-page-header__detail-row slds-section slds-is-open">
            <h3 class="slds-section__title slds-theme_shade">
                <span class="slds-truncate slds-p-horizontal_small" title="">System Information</span>
            </h3>
        </div>        
        
        <lightning:layout horizontalAlign="space">
            <lightning:layoutItem class="slds-col slds-size--1-of-2">
                <lightning:outputField fieldName="CreatedDate" />
            </lightning:layoutItem>
            <lightning:layoutItem class="slds-col slds-size--1-of-2">
                <lightning:outputField fieldName="LastModifiedDate" />
            </lightning:layoutItem>
        </lightning:layout>
       
    </lightning:recordViewForm>
</aura:component>

 
Best Answer chosen by Natacha Joseph
Natacha JosephNatacha Joseph
Hi !  This week my problem came back, but I was able to fix it by using another way to display my custom object details.
I used <force:recordView recordId="a02D0000006V8Ov" type="FULL"/> instead of buildinf the form to display.
I prefer this method because it uses the page layout to display the information, so I can manage more easily.
 

All Answers

sfdcMonkey.comsfdcMonkey.com
add force:hasRecordId interface  to your lightning component 

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >

and add this lightning component to your AGF_Proposal__c lightning record detail page, and it will be work 

Thanks 
 Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
http://sfdcmonkey.com
Natacha JosephNatacha Joseph
Hi piyush, i just tried it and it does not work...
My sandbox in on spring '18, I wonder if it is the problem ?

I will try it on a sandbox with the previous release and i'll get back to you.
Natacha JosephNatacha Joseph
Hi !  My code work with Winter '18, event without the force:hasRecordId
So the problem started with the spring '18 release.

Thank you for your help !
Natacha JosephNatacha Joseph
Hi !  This week my problem came back, but I was able to fix it by using another way to display my custom object details.
I used <force:recordView recordId="a02D0000006V8Ov" type="FULL"/> instead of buildinf the form to display.
I prefer this method because it uses the page layout to display the information, so I can manage more easily.
 
This was selected as the best answer