function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jim GerrardJim Gerrard 

lightning:inputField - apparent bug in lookup-filter handling

Hi all,

I'm hoping for some attention from the Lightning team, but would appreciate any light anyone could shed on this.

We have a customer who has added a custom lookup field to the Opportunity object, pointing to Contact, with a lookup-filter criterion that permits only contacts related to the opportunity's parent account. The standard "new" page, when editing the custom relation, correctly shows a 2-item list containing one appropriate contact and a "new contact" item:
User-added image

Meanwhile, we have a "new" Lightning override page that uses lightning:inputField inside a lightning:recordEditForm, and the relationship field doesn't seem to work correctly: it shows only a "recently used contacts" list that does not include the only Contact conforming to the lookup-filter criterion, and shows other ones instead:
User-added image

If the user starts typing to find a contact and uses the "search" list item to activate the advanced search window, the list still shows only irrelevancies. Even if one of these incorrect records is selected, the user is prevented from saving the record because pre-save validation notices that the record violates the lookup-filter criterion:
User-added image

In short, this really looks to us like a boolean-inversion bug in the code for the lists, presumably in an SOQL WHERE clause (or equivalent) that retrieves candidate contacts to populate it.

best regards,
Jim
Darshan Gandhi 9Darshan Gandhi 9

JIm Gerrad 

Can you share your SOQL code.