Here are steps what i did
1. Create a lightning component with lightning:recordeditform. Inside this form lightning:inputfield will hold values.
2. Assign this component to record detail page or quick action as per objectApiName in lightning:recordeditform.
3. Consider inside that form some fields are lookup fields. Remove those fields from page layout.
5. Now open any record and now see that component section. None of the lookup are populated.
Is anybody face the same issue and have solution help me.

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global">
            <lightning:recordEditForm aura:id="recordEditForm"                                   
                <lightning:messages />
                        <lightning:inputField fieldName="Name" />
                        <lightning:inputField fieldName="Account_Lookup_Test__c"/>
                        <lightning:inputField fieldName="Account_Lookup_Test2__c"/>
                        <lightning:inputField fieldName="Contact_Lookup_Test__c" /><br/>
                        <lightning:inputField fieldName="Contact_Lookup_Test2__c" />

  • It's working for me. Are you sure about the recordTypeId value? Apr 18 '18 at 8:38
  • I removed recordTypeId and tried again it gives the same issue. Have removed all those fields from page layout first?
    – Rajesh
    Apr 18 '18 at 8:43
  • Where are you rendering this component? Did you add it to the opportunity record page? Apr 18 '18 at 9:02
  • yes. It's on opportunity record page.
    – Rajesh
    Apr 18 '18 at 9:35
  • <lightning:recordForm /> also having the same issue.
    – Rajesh
    Jul 13 '18 at 7:32

lightning:recordEditForm doesnt render those fields that are not contained in the related layout.

That layout is defined by the RecordTypeId (which is the default one in case you dont chose any).

  • Yup! Can we overcome that. Also it populated once that component get refreshed. In detail just edit any field and save it. Now record page will refreshed without page load. Now see the component section some of those are populated. I don't know what is the logic behind this.
    – Rajesh
    Apr 19 '18 at 4:53
  • So, you mean during edition just some of the changed fields are being refreshed? Apr 19 '18 at 8:10
  • I means to say if the component get refreshed without page reload it populate some fields. You can use $A.get("e.force:refreshView").fire() to refresh the component. Just create button in that component,execute $A.get("e.force:refreshView").fire() in onclick method from js controller.
    – Rajesh
    Apr 19 '18 at 8:23

Here is a one of the trick..
Embed hidden <lightning:recordViewForm> in your code. Which is holding your lookup fields just like below code.

    <lightning:recordViewForm recordId="001XXXXXXXXXXXXXXX" objectApiName="Contact">
        <div class="slds-box">
            <lightning:outputField fieldName="Account.Id" />
            <lightning:outputField fieldName="LookupField__c" />
  • "LookupField__c", is this a new custom field you created? What are you storing in this? Aug 10 '18 at 9:30
  • yes LookupField__c is a custom lookup field. Here we are not going to store anything. Basic idea is "<lightning:recordViewForm>" does not have issue with lookup fields whether it may or may not be in layout. So if we load the lookup fields inside the "<lightning:recordViewForm>" it will populate lookup fields on "<lightning:recordForm />" or lightning:recordeditform. Try this. @NishantSinghPanwar
    – Rajesh
    Aug 10 '18 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.