Anyone got a lightning:inputField working for a lookup?

I have a lightning:recordEditForm containing lightning:inputFields that I want to use to create a simple custom object. The 3 fields are:

  • A picklist
  • A lookup to Contact
  • A lookup to Account

presented like this:

<lightning:recordEditForm objectApiName="MyObject__c">
    <lightning:messages />
    <lightning:inputField fieldName="Type__c" />
    <lightning:inputField fieldName="Contact__c"/>
    <lightning:inputField fieldName="Account__c"/>
    <lightning:button  variant="brand" class="btn" type="submit" label="Create" />

The lookup fields work to some degree except that the generated HTML has and displays as placeholder:


and this text is displayed at the top of the list of recent objects:


and when there are no matching search results this text is displayed that is a working link to a more comprehensive search/add UI:


and only the FirstName is displayed in the list of matches for the Contact lookup not the Name.

And double clicking after the selection has been made blows up the page.

Looks like incomplete code; I’m working in a scratch org created on 8 Feb 2018: is this working fully for anyone?


The submit is also failing. I see this via the onsubmit event (note that cvux__Intake__c has a defined Id value here):


and get a bland error message displayed that inside the onerror has more detail:

“data”:{“message”:”An error occurred while trying to update the
record. Please try
fields are missing:

where cvux__Intake__c is a master-detail to a parent object reported as missing.


Changing the cvux__Intake__c to a lookup fixes the submit problem.


For now quick fix is CHECK “Allow reparenting” checkbox for the Master-Detail field on the child object. You will not get error

Source : Link , Question Author : Keith C , Answer Author : Ven

Leave a Comment