Microsoft Dynamics CRM 2016 Service Pack 1 (SP1) introduces the “Customer” field type – a new data type which gives you the ability to add a lookup field to a customizable entity which allows users to select Accounts or Contacts. Requests for this feature date back to the CRM 4.0 days, so it is nice to see that it is finally here after all these years.
In previous versions of CRM, Customer lookups were only available on several out of the box entities such as Case, Lead, and Opportunity (just to name a few). For custom entities, you would have to create two separate lookup fields – one to the Account and one to the Contact. I have also seen implementations where developers hacked their way to create their own multi-lookups, which of course is unsupported.
Creating a Customer lookup is as easy as creating a regular lookup, with one additional step. The steps are as follows:
1. Navigate to Settings -> Solutions and open up your solution
2. Expand the Entity you wish to add the Customer lookup to. In my example, I am using a custom entity called Event (schema name rosh_event).
3. Expand Fields and then click on New
4. Enter the details of your field, and for the Data Type select Customer
5. Specify the names of the Account and Contact relationships
The names of the relationships aren’t immediately obvious, so a good guide is to see what name CRM suggests when creating a regular lookup. For example, if we create a regular lookup to the Account entity, CRM will suggest the name rosh_rosh_event_account. Based on the suggested name above, I would provide the following relationship names:
Add the field to your form and publish customizations. When you click on the lookup, you will see that both Accounts and Contacts are available to select.
Customer lookup fields can be added to views and are sortable, filterable, and searchable using Quick Find.
You cannot set Related Record Filtering or Additional Properties at the form level like you can do with regular lookups.
The platform adds multiple fields in the background as shown in the screenshot below. The same fields are available using filtered views for reporting. The <prefix>_CustomerIdIdType field can be one of two values – “1” to represent Accounts or “2” to represent Contacts.
Customer lookup fields also work on entities enabled for the Interactive Service Hub (ISH), although there are a number of unrelated defects in ISH that may prevent you from saving records and using views.