2

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.
Component

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global">
            <lightning:recordEditForm aura:id="recordEditForm"                                   
                                          recordId="{!v.recordId}"
                                          recordTypeId="0127F000000UdRuQAK"
                                          objectApiName="Opportunity">
                <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" />
            </lightning:recordEditForm>

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

2 Answers 2

1

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).

3
  • 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
    Commented Apr 19, 2018 at 4:53
  • So, you mean during edition just some of the changed fields are being refreshed? Commented Apr 19, 2018 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
    Commented Apr 19, 2018 at 8:23
0

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" />
        </div>
    </lightning:recordViewForm>
2
  • "LookupField__c", is this a new custom field you created? What are you storing in this? Commented Aug 10, 2018 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
    Commented Aug 10, 2018 at 10:16

You must log in to answer this question.

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