Loading

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

Дата публикации: Jul 5, 2023
Описание
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)
 
Решение
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. 
 
Номер статьи базы знаний

000380201

 
Загрузка
Salesforce Help | Article