Dynamics CRM- Rollup with Custom Hierarchies

CRM Custom hierarchies are very useful feature for maintaining hierarchy among records and also provide nice visualization of the Hierarchies.

Learn more about hierarchies here: http://www.powerobjects.com/.015/03/30/microsoft-dynamics-crm-2015-custom-hierarchies/

With rollup fields and custom hierarchies have become even more useful to derive and visualize meaningful data in the hierarchy. In this blog, we will use how to leverage Rollup fields and Custom hierarchies to get proper data and avoid redundancy and custom calculations.

Problem statement:

Suppose you have a custom hierarchy of campaign, so a campaign can have multiple child campaigns. Each campaign has leads associated to it.

The requirement is to get the count of all the leads of the related child campaigns and also itself.

Solution:

If you want count of leads on the campaign, we can easily create a rollup field on Campaign to get the count of leads on Campaign. The rollup field will look like below:

rollupwithcustomhierarchy1

You can see the count of leads using the above rollup below on the campaign form:

rollupwithcustomhierarchy2

Get total lead count of child campaigns on Parent Campaign

Without hierarchy to achieve this, we would need to write a custom plugin or JavaScript to get the lead count of all the child campaigns and set it on the parent campaign.

With rollup using hierarchy, we can get this done without any calculations. See below the rollup definition for this. Note that we have now enabled “Use Hierarchy” in the rollup definition.

rollupwithcustomhierarchy3

This will get us the count of all leads including Child campaign as well.

See the form now with the updated rollup definition, the lead count is now “8” which is the sum of lead count of all child campaigns

rollupwithcustomhierarchy4

Conclusion:

Leveraging Calculated fields, rollup fields and custom hierarchies we can easily build good and simple solutions, avoid custom calculations and redundant fields.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s