26 Oct’16

Dynamics CRMDynamics 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.

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.


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:

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

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.

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.


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


Written by

Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Reading more then 10K records in D3FOE OData API

    11 July’ 2018

    Introduction: We all know Dynamics 365 Finance and Operations has limitation of 10K records to be fetched at a time usi...

    Read more
  • Paging in D365 Customer Engagement v9.0

    10 July’ 2018

    Introduction: The Xrm.retrieveMultipleRecords method is used to retrieve a collection of records in Dynamics 365 Custom...

    Read more
  • Set up Dynamics 365 connection in Microsoft Social Engagement

    10 July’ 2018

    Introduction: This blog explains how to Set up Dynamics 365 connection in Microsoft Social Engagement. Steps to be follo...

    Read more
  • Voice of the Customer failed to install

    10 July’ 2018

    Introduction: Many people face issues in installing Voice of Customer solution on v9 environment and trying repeatedly ...

    Read more
  • Scribe Insight AX as a Web Service Find Block issue

    10 July’ 2018

    Introduction: If we need to look up for any value from AX then we do it by using a Find Block in Scribe Insight Eg: Basi...

    Read more