[SalesForce] Lightning inputfield on a lookup

I'm having difficulties,

Here is the code and setup :

 <lightning:recordEditForm objectApiName="CustomObject__c">
 <lightning:inputField aura:id="accCompId" fieldName="PAccount__c" onchange="{!c.updatePersonInfo}"/>
 <lightning:inputField aura:id="signCompId" fieldName="Signatory__c" onchange="{!c.updateContactInfo}"/>
</lightning:recordEditForm>

Here is the result when I try to look for an existing record that the user has access to (on left panel it's the lookup inputfield, on right panel it's the record page)

Contact not found from lookup inputfield

The inputfield for PAccount__c is giving me the results based on the text search, but the Signatory__c (lookup to Contact) isn't. I checked the filter, profile, OWD, all seems correct. Any idea why can't the user see the contacts ?

Best Answer

As I know lightning:recordEditForm doesn't work as expected with lookups when you try to create records, it should be ok to use if you edit existing records only.

So the options are:

  • use custom lookup component
  • set the lookup Id value if you know the Id upfront

Check out this answer as well.

Related Topic