Scenario – You have a lookup field to contact on your opportunity record. Let’s name the field as Opportunity Spoc.
Users when creating the opportunity record need to mention the contact name which is the primary source of contact for this opportunity. Now, as an admin you have found some discrepancy in the opportunity spoc data. You have observed that the users not always select the contact record in the lookup belonging to the account on which the opportunity is made. They sometimes add the contact which is associated with a different account.
Now How to Fix this?
Lookup filters to the rescue.
What are Lookup filters?
Lookup filters are administrator settings that restrict the valid values and lookup dialog results for lookup, master-detail, and hierarchical relationship fields.
You can create lookup filters to limit the search results in the lookup field while selecting a record in the field.
How to define lookup filter?
To limit the contact lookup on opportunity record,
- Go to object manager then select opportunity.
- In field and relationships, search for the contact lookup field name and edit it.
- Scroll down and you will see a section by the name of Lookup filter. Click on show filter settings.
- Field – Opportunity Account ID Equals Field Opportunity Spoc: Account ID
We are matching the account id from the account lookup on the opportunity record and the account id from the contact record. If these two are same then they belong to the same account.
Now the users will only be able to see the contact records in the lookup field which has the same account as your opportunity.