When creating a lookup field you are essentially relating the field to another object (e.g, table) for its values. They can be used to lookup a value on related lists, be useful for relating objects for custom report types, or create a relationship for tracking to name a few.
LookUp fields can use filters to drill down on specific data to display in the picklist or they can be based on the value of another field, or a combination of both.
Using another field’s value to determine another field’s choices can be helpful. The best example of this is the Related To and Name fields on many Salesforce pages. Once you choose and Account in the Related to value, the Name lookup will only accept Contacts related to that Account (in most organizations). The same principle can be applied to other lookup relationships such as from Orders to Products or Opportunities to Orders.
For this example we will expand on the Partner Look Up field on the Account object to assign the Technology Partner Account for the client. Now we not only want to relate the Partner company but we also want to relate the representative working with client.
To add a LookUp field with a filter:
- Click on SetUp (Gear Icon) and then click on the Object Manager
- Click on the object you will be adding the Look Up field to. For this example we are using the Account object.
- Select Fields & Relationships and then click the New
- Select Lookup Relationship from the Data Type list and click Next.
- Select Account from the Related To dropdown and click Next.
- Enter the following:
- Field Label – Technology Partner
- Field Name will auto populate
- Add a Description and/or Help Text is desired
- Leave the Child Relationship Name as is
- Click Show Filter Settings in the Lookup Filter Section.
- Click in the field box and choose Current Lookup then the name of the lookup field and then the field to filter on.
- Choose equals for the operator and Value for the Value/Field.
- Depending on the type of field you are filtering on, a picklist may be used to select the value. Otherwise type the value.
- Click on the Search icon and choose Technology Partner from the picklist values.
- Choose if the field will require a value.
- Select to Active so the filter can be used. Click Next.
- Choose who will see the new field and do not make it read only. Click Next.
- Choose which Account Layouts will display this field. Click Next.
- Choose which Vendor Account Layouts will display this field. Click Save.
Navigate to the page you added the field to and test it.