Microsoft Dynamics CRM now provides you with a hierarchical view of records out of the box for selected entities, with the ability to customize this view for custom relationships. It is also possible to customize the hierarchy tile view to display different fields on each tile.
Firstly, let’s see how the out of the box Account to Sub-Account relationship is configured to display a hierarchical view. If we go into our customizations area and take a look at the 1:N relationship self-referential relationship for Accounts, we will see a new Hierarchical option which is set to “Yes”. Note that this cannot be changed.
Looking at the Account to Contact 1:N relationship, we will see that this option is set to “No” and again cannot be changed. This means we cannot view Contacts belonging to a particular Account from within a hierarchical view. The 1:N self-referential relationship for Contacts is also not enabled for hierarchies.
Can I enable Hierarchies for Custom Relationships?
You sure can! Here I have created a custom 1:N self-referential relationship for Contacts and have set Hierarchical to “Yes”.
Next, we need to create a new Hierarchy Setting under the Contact entity. This is done under the entity configuration and is solution-aware which means the rules are included when you deploy the solution to another environment.
Clicking on New brings up the configuration settings for a new Hierarchy. Enter a unique Name and select a Default Quick View Form which will be used when displaying the tiles for each record in the hierarchy. I have decided to use the Contact Quick Form but you can also choose to create a new Quick View Form if you wish.
To obtain a list of relationships for the current entity which are enabled for hierarchies, click on the hyperlink. You can select a relationship in the list and mark it as hierarchical.
Click on Save and Close and then publish all customizations. After linking Contacts together via my new custom relationship, I can now see that these records are part of a hierarchy and I can simply click on the hierarchy button to view the hierarchy.
Notice how we have four fields on the hierarchy tile. The default Contact Quick Form also includes the Company Name field, but this is not displayed on the tile. It appears that only a maximum of four fields can be displayed. I have added the Home Phone field before the Mobile Phone to illustrate my point.
Notice how the Mobile Phone field is no longer displayed.
There you have it! A very simple way to configure entity relationships to take advantage of the new hierarchy feature in Dynamics CRM. Remember that the hierarchy feature is available for the Account, Campaign, Case, Contact, Opportunity, Order, Product, Quote, Team and User entities.