Rollup Fields for Meaningful Account Hierarchies

As a sales manager, you might want to take a look at a complex account that has multiple subsidiaries, with insight into the consolidated sales situation. A hierarchical visualisation such as the following is nice to have:
Rollup-1500viewVis
You can accomplish this with a combination of calculated- and rollup fields.
I will talk you through this step-by-step:

  1. On the Opportunity entity, create a calculated currency field called Weighted Revenue – Weighted Revenue is defined as Probability x Estimated Value:
    Rollup-100_Add_Weighted_Revenue
  2. Edit the new field to specify the calculation formula:
    Rollup-200_SetWeightedRevenue
  3. Publish the Opportunity entity.
  4. On the Account entity, create a rollup field named Opportunities (Unweighted):
    Rollup-400_AddOpportunitiesUnweighted
    Rollups are for calculations across one-to-many relationships (like the sum function in Microsoft Excel).
  5. Edit the new field to specify the rollup calculation formula. Set Use Hierarchy to ‘YES’ and then specify the related entity:
    Rollup-510_Related
    In this example it is Opportunities (Account). Specify the relevant relationship field in your case.
  6. Specify that the rollup must filter to include only Open Opportunities:
    Rollup-600_Filter
  7. Specify the Aggregate function, in this case, the sum of the Estimated Revenue on the Opportunity field:
    Rollup-700_Sum
  8. Create an Opportunities (Weighted) rollup field on the Account entity by applying the same steps as above (steps 4 to 7), except that this time, the aggregate function is the sum of the Weighted Revenue on the Opportunity field:
    Rollup-800_OppWeighted
  9. Customise the display of the hierarchical visualisation by adding the two new fields on the Account Hierarchy Tile form:
    Rollup-900_AddtoAccountTile
  10. Also add these two rollup fields on the Account form and publish the Account entity.
  11. To see the rollup fields in action, navigate to a view of your Accounts:Rollup-1100_ViewHierarchy
    Click a ‘View Hierarchy’ icon (on the left of the Accounts) and notice two problems — no totals are displayed and the field labels are truncated:
    Rollup-1150_ViewHierarchy
  12. Edit the labels on the Account Hierarchy Tile form to shorten the text. For example, use ‘Odds’ instead of ‘Probability’:
    Rollup-1200_ViewEditedHierarchy
  13. Open an account record to have a look at the calculated rollup fields. Hovering over the fields displays a tooltip that the field has not been calculated yet:
    Rollup-1300_ViewAccount
    Rollups automatically calculate across all affected records 12 hours after being created for the first time. After that, they recalculate on an hourly basis, using asynchronous system jobs.
  14. To calculate values for this record immediately, click the Refresh button on each field.
    Rollup-1400_calcFields
    Once a rollup field is calculated on a record, it is saved on the record. Note that this updates only this one record.
  15. Calculate Opportunity fields on a sampling of your Account records and click the Hierarchy icon (top right on the record window) to have a look at the Visualisation:
    Rollup-1500viewVis
  16. To force the calculation to happen sooner across all the records, navigate to Settings/Systems Jobs. Filter with ‘Recurring System Jobs’ and double-click the ‘Mass Calculate…’ job for one of your new rollup fields:
    Rollup-1600_MassCalc
  17. Choose ‘Actions/Postpone’(sic):
    Rollup-1700_MassCalc1
  18.  Move the job run to the current date and time and OK:
    Rollup-1800_MassCalc2
  19. Run the equivalent ‘Mass Calculate…’ job for the other rollup.
    On completion the Hierarchical Visualisation shows the correct data for all your records.

More About Rollup Fields

According to MSDN article http://msdn.microsoft.com/en-us/library/dn817863(v=crm.7).aspx#BKMK_Rollup, the Mass Calculated Rollup Fields job will occur immediately when a solution containing a rollup attribute is imported. This assumes that you are installing a solution during a time that won’t adversely impact users.
It also lists the following limitations:

  • Rollup attributes can’t be used as a workflow event or wait condition. These attributes don’t raise the event to trigger workflows.
  • The ModifiedBy and ModifiedOn attributes for the entity aren’t updated when the rollup attribute is updated.
  • A maximum of 100 rollup attributes can be defined within an organization. Each entity can have no more than 10 rollup attributes.
  • A rollup attribute formula can’t reference another rollup attribute.
  • A rollup attribute formula can’t reference complex calculated attributes. Only calculated attributes that reference simple attributes in the same record can be used with rollups.
  • A rollup attribute formula can’t include records in many-to-many (N:N) relationships. It can only include records in one-to-many (1:N) relationships.
  • Rollup attribute formulas can’t use one-to-many (1:N) relationships with the ActivityPointer or ActivityParty entity.

About Relationships between Opportunity and Account/Case
Dynamics CRM has always had a composite lookup field on Opportunity called Potential Customer (customerid) that would identify the potential Account or Contact. When business process was introduced to CRM 2013, we gained two new fields: Parent Account and Parent Contact, which can now also be used to identify the Potential Customer.

The Case entity, on the other hand, still uses a composite field for the Customer (customerid), and has an additional relationship Responsible Contact (responsibleconatctid). The composite relationships also can’t be used in calculated fields to lookup attributes from the parent record types, so having separate relationships may actually work easier in practice.

The differences in approaches are confusing and the constraints don’t make an awful lot of sense. Some guidance on this from the product team would be welcome. In the meantime, take care to base your logic on the relationships used by your project!

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

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