Monday, August 19, 2013

Salesforce: Lookup Filter

Lookup relationship is one of the best feature in Salesforce, you can easily link one object to other object. Furthermore, you can create filter in lookup field using Lookup Filters.

Lookup Filters are administrator settings on lookup, master-detail, and hierarchical relationship fields that restrict the valid values and lookup dialog results for the field.

As of now, Salesforce supports lookup filters on relationship fields that point to:
  • Accounts
  • Assets
  • Contacts
  • Entitlements
  • Quotes
  • Service contracts
  • Users
  • Custom objects

For example, you can define a lookup filter on opportunities that points to accounts, but not vice-versa.
In coming Spring '14, Salesforce add support for lookup filters on relationship fields that point to the following objects: Campaigns, Cases, Contracts, Ideas, Leads, Opportunities, Products, and Social Personas. Also added a Related Lookup Filters node to all newly supported objects in Setup menu.

Sample: User would like to see Contact only from same selected Account in the Opportunity.
You can easily using Lookup Filter to achieve this. Add Filter Criteria, Filter Type, Lookup Window Text and option to Active the filter.

If you edit page layout, you will see Contact here will depend on Account.

Here is screenshot when user click Edit in page detail, see Account name, when Account change, Contact will become not valid and user have to select Contact from new Account selected.

Related Lookup Filters
You can easily identify if an object is filtered by other object. In sample above, Contact is filtered in Opportunity object. Instead go to Opportunity field or any other object one-by-one, you can check all in Contact object Related Lookup Filters; go to Setup - Customize - Contacts - Related Lookup Filters