Here’s a quick example of configuring a filtered lookup in 2011.
In this scenario we want to be able to specify on an Opportunity who the Key Customer Contact is and when selecting this Contact we want the lookup to only offer up the Contacts attached to the Opportunity Customer.
1. Let’s start by adding a Key Customer Contact field to the Opportunity entity / form. Note: I love how much more fluent this process is in 2011…
a. Open the Opportunity form, click on the Customize ribbon tab and then click Form. The Form Designer will launch.
b. Click the New Field button. The New Field dialog will display.
c. Enter “Key Customer Contact” as the Display Name for your new field, select Lookup as the Type, and then select Contact as the Target Record Type. Save and Close. The field will be created and you will be returned to the Form Designer.
d. Your new Key Customer Contact field will appear in the Field Explorer list, drag it onto the Opportunity form
2. At this point you might like to test things, so do a Save & Close of the Form Designer – you will be returned to the Opportunity form – click the All Customisations button on the Customize menu, and then refresh your browser window.
3. Ok, let’s now add the filtering. Open up the Form Designer again (click on the Customize ribbon tab and then click Form).
4. Double-click on the Key Customer Contact field – the Field Properties dialog will display.
5. The relevant settings are in the last 2 sections – here’s how they will look initially
Note: there is no related record filtering going on. The lookup dialog is set to display the “Contacts Lookup View” with other all other Contact views able to be selected and the Search box enabled.
6. To enable the filtering we check the Only show records where: option in the Related Records Filtering section
7. Next, we need to specify the source value from the Opportunity record to pass into the lookup and the destination field on the Contact entity on which to filter. In our scenario the source value is the Potential Customer field on the Opportunity form and the field on the Contact on which we wish to filter is the Parent Customer field.
8. We need to decide whether this restricted list needs to be enforced or whether we are only doing this to be helpful and users should be able to optionally select a Contact from another Organisation. In this scenario we want to enforce this so we uncheck the Allow users to turn off filter
9. That’s it, you can save, publish and refresh to see the filtering in action. Optionally, you can remove some of the clutter from the lookup dialog by disabling the display of the search box and turning off the View Selector
Here’s the end result – the Key Customer Contact lookup dialog now only offering the Contacts that are related to the Opportunity Customer:
Finally, some words of caution on this feature – the filtering is only applied at run time as the user is populating the lookup field, it is not enforced after that point. i.e. If having selected a Customer and a Key Customer Contact you then change the Customer field the Key Customer Contact field is not re-validated, CRM will allow the field to retain a value that would not be offered up by the filtered lookup.
Think of this feature as a helper for your users, not as means of enforcing data integrity. For that level of control you will need to consider some jscript or plugin code.