Loading

Lookup field in lightning:recordEditForm needs to be included in Page Layout

Date de publication: Jul 5, 2023
Description
When using Lookup Field in lightning:recordEditForm, the field value may not show the existing data. This is because the lightning:inputField is currently populated only when the field is added to Page Layout. This behavior is also seen with Lightning Web Component (LWC) version of Record Edit Form (lightning-record-edit-form)
 
Résolution
Create a Lightning Component tab with following code 
<aura:component implements="force:appHostable"> 
  <lightning:card title="Lookup Field Edit"> 
    <lightning:recordEditForm recordId="a00S6000000xxxxxxx" objectApiName="CustomObject__c"> 
      <lightning:inputField fieldName="Account__c" /> 
    </lightning:recordEditForm> 
  </lightning:card> 
</aura:component>
Open tab and see the field value shows 'Search..' if the field is not added to Page Layout. Field will be correctly populated when added to the Page Layout. 
 
Numéro d’article de la base de connaissances

000380201

 
Chargement
Salesforce Help | Article