Filtered lookups was an oft asked for feature in the yesteryears of Microsoft Dynamics CRM 3.0 and CRM 4.0 with a variety of solutions being offered and implemented to tackle it – all of course were unsupported. With Microsoft Dynamics CRM 2011, the guilty pleasure of custom hacking an unsupported solution to achieve filtered lookups and bragging about it has been denied by Microsoft. So instead I will blog about the out of box solution for filtered lookups in Microsoft Dynamics CRM.
Let's take an example and work through it – suppose you want to have a relationship on the contact record that specifies the preferred shipping partner. But you also do not want all accounts to be displayed in the lookup which includes all types of accounts – in other words, you want the "Preferred Shipping Partner" field to be a filtered lookup to Accounts that displays only the accounts which have an account type of "Shipping".
It all starts in the customization section under the setting area of CRM 2011. This is what you need to do:
- Navigate to Settings > Customization
- Launch the working Solution or if you do not have one, either create one or click on "Customize the System"
- Navigate to the entity for which you want to have a filtered lookup. Here we want Accounts to be filtered, so let's go to Accounts
-
Create a filtered view as per your criteria. Set the filtered criteria as "Account Type" equals "Shipping" and name the view as "Shipping Partner". Of course if the field "Account Type" doesn't exist, then you need to first create it before you can use it in the filter criteria!
The field Account Type has also been added to the columns. Use the "Add Columns" to add columns and "Edit Filter Criteria" to add the Filter as shown below.
- Navigate to the child entity, on which you want this filtered view to show up. This would be contact entity as per our example. We want the filtered account lookup to show on the contacts form
-
Navigate to the Many-To-1 relationship to ensure that the relationship exists from the parent entity to the child entity, if it doesn't then create one. We will create a Many-To-1 relationship with the Parent as Accounts and the Child as Contact and name the lookup field as "Preferred Shipping Partner"
- Navigate to the Forms section on the child entity and open the form on which you want to show the filtered lookup. We will open the Main Information form
- Add the lookup field to the Form. Just double click on the "Preferred Shipping Partner" to add it to the form.
- Double click on the field to launch its properties or click on the "change Properties" button in the ribbon.
-
Click on Details tab in the Field Properties window and scroll down to "Additional Properties" and select the filtered view created for the parent entity as the Default view. We will select the "Shipping Partner" view which we created earlier for Accounts
- Save and publish your customizations
- That's it! You are done.
Let take a little closer look at the options available in the 'Additional Properties' section:
What other features in CRM 2011 would you like to get a more in-depth look at from the CRM Experts at PowerObjects?
Happy CRM'ing!
Hey is it possible, to search for dynamic values?
For Example the lookup view should only render facilities of the current company? I dont want to use the real name but only a place holder.
thanks!