Lookup field filter does not work on record creation
|Knowledge Article Number||000239898|
|Description||When a filter has been implemented on a lookup field users may find that they're unable to locate related records via the lookup dialog search when creating a new record despite records existing and matching the filter's criteria. Users will also find that the same lookup search returns expected records upon editing the newly created record after saving.
1. Create a custom lookup field on the Case object to Opportunity.
2. Create a custom lookup field on the Quote object to Case and add a filter with the following criteria:
Quote: Opportunity ID equals Field Case: Opportunity: Opportunity ID
3. Create an Opportunity record and then several Case records associated to the Opportunity.
4. Open the Opportunity created in step 3. and create a new Quote record via the Quotes related list.
5. In the Case lookup field try and search for the cases you created in step 3.
Actual Results: When creating the Quote record you're unable to locate the Case records via the filtered lookup. However, if you click "Show all results" to remove the filter the expected results are returned or if you input a matching case number into the lookup field on the Quote edit page (without searching) you're able to save the record and the lookup filter works when editing an existing record.
|Resolution||If your lookup filter criteria uses a Master-Detail (M-D) relationship the lookup filter will not work upon record creation.
This behavior is working as designed and a limitation of lookup field filters not being able to leverage M-D relationship fields in lookup filter criteria. Only relationships of Data Type: Lookup can be used to establish lookup filter criteria to properly reference related object records during record creation.
In the example scenario provided above, since the record being created (Quotes) is in a M-D relationship with Opportunities, the lookup's filter doesn't have the ability to span the Quote to Opportunity relationship on record creation. However, if the Quote to Opportunity relationship field was of type Lookup the filter logic would be able to properly span the filter's relationship path.
As a workaround to this lookup dialog search limitation consider removing the lookup's filter or populating the field after the record has been created.
Notes on Lookup Filters
Why don't I get the results I expect when I do a Lookup Search on a field with Lookup Filters defined?
Why don't I get the results I expect when I do a blank Lookup Search on a field?