In the real world, our customers are either individuals or a group of individuals such as a company. However Microsoft has always made a distinction when it comes to how we organise our data models especially with custom entities – you’re either one or the other, requiring separate lookups for each. Not anymore! One of the neatest new features of CRM Online 2016 Update 1 (CRM 2016 SP1 for On-Premise) is the introduction of a new Attribute Data Type called “Customer”.
A Customer Data Type is a form of Multi-Entity lookup. One which when selected you can choose between different entities. You may have seen Multi Entity Lookups used commonly throughout all previous versions of Dynamics CRM, for instance on activity entities where you can select either a Contact or an Account or a number of other default entities. But previous versions have not allowed you to create your own multi-entity lookups without some extensive JavaScript customisations. That has changed with the introduction of the Customer Data Type.
Here’s how to create a Customer Attribute:
- When creating your field, select the Data Type of Customer from the drop down menu.
- Check that you’re satisfied with the pre-defined relationship names “To Account” and “To Contact”.
- Save and Close
- Navigate to your Main Form designer
- Add your newly created field (in this case Related Customer) to your form.
- Save and Close
- Publish your entity changes
How to use the Customer Attribute
Upon opening the form with the newly created Customer attribute, and navigating to the lookup “More Records” function you will see a drop down selection on the pop-up dialog allowing for switching of contacts and accounts.
- Go to your newly created lookup
- Select Look Up More Records.
- Change Look For option from Account to Contact
- You will see your lookup view updated to target contacts.
If you’re developing code for this new attribute, make sure you look at the sample code to create customer relationship at the MSDN website.
https://msdn.microsoft.com/en-us/library/gg509035.aspx#BKMK_createcustlookup
This is one of my favourite enhancements to the CRM platform, as it allows us to simplify entity design and gives us a supported way to achieve multi-entity lookups. Presently it is limited to just Contact and Accounts, and I personally hope that Microsoft opens the possibility of having custom entities included in future releases. If you have any comments about this blog post please leave a message below.