How to setup the new rollup fields to count the number of cases associated with a contract line
In this article I will explain step by step a concrete example of usage of the new rollup fields in CRM 2015, which is to count the number of cases associated with a contract line.
In Dynamics CRM, we have different types of contract templates depending on their allotment type:
- Number of cases: entitles the customer to care for x number of cases
- Time: the customer is entitled to x hours of attention (eg up to 10 hours of support.)
- Coverage dates: the customer is entitled to unlimited attention given date range.
This is how a contract made with the “Number of cases” template looks like with its lines, including its respective allotments used (in the example, the customer has received attention to 145 cases under that contract line)
The problem with Coverage dates contracts and why the new rollup fields are so useful is…
.. that Allotments Used field remains in 0 (zero), it isn’t updated when allotment type = converage dates.
Therefore, it is an excellent setting where to apply the new rollups fields :), to roll up the total number of cases handled under that contract line.
Let see how to do this.
How to configure a rollup field that counts the number of cases associated with a contract line:
- Create new rollup field in Contract Line entity
- Click on “Edit” to set up the rule (at that time if we had not saved it yet, the field is created)
- Within the rule, select Case as related entity.
- We indicate aggregation type, COUNT (“COUNT”):
- We finished set up our field! :). Save and close.
- Now we can add our field to Active contract lines view so we can display the counter in the view of the contract:
- Save, publish. Check contracts with lines that have associated cases and voila! Our new field is working great!
- We can also edit the main form for Contract Line entity to include our field:
- Save and publish the form and we can see our new field working also on the form.
Ohh..and one more thing: the good thing is that this field line works for any contract of any type of contract, regardless of their allotment type :).
I hope you enjoy it and find it has been helpful! :).