Loading

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

Publiseringsdato: Jul 5, 2023
Beskrivelse
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)
 
Løsning
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. 
 
Knowledge-artikkelnummer

000380201

 
Laster
Salesforce Help | Article