HOWTO: Use Sugar Logic Rollups

sugarcrmdevelopers —  February 13, 2012 — 8 Comments

A great new feature that came with Sugar 6.3 is the ability to do rollups, meaning that you can do a calculation over a single field in all of the related records of a related module. You can do four different types of rollups in Sugar 6.3:

  • rollupMax – return the max value of all of the related module records
  • rollupMin – return the min value of all of the related module records
  • rollupSum – return the sum value of all of the related module records
  • rollupAve – return the average value of all of the related module records
  • count – return the total number of related module records

Here’s a great use case for this; suppose you want to add a field to the Accounts module which sums the average Opportunity amount for an account. Just add a new field with this equation as the calculated field:

rollupAve($opportunities,"amount")

Or maybe you are looking for the total number of Cases submitted by a Contact. Try this formula on a new field:

count($cases,"amount")

This enables all sorts of new abilities. Have you used these fields? If so, sound off in the comments on how you use these functions.

8 responses to HOWTO: Use Sugar Logic Rollups

  1. 

    I Love this new feature however I need to add a date parameter, as in make the sum only count the records added in the last 30 days. I am working on making a custom formula top achieve this. Can you point me to the Type of expression these are?

  2. 

    Hi me again, I have raised a ticket and I am trying to work around the issue in the meantime. I created some calculated fields which mean that the value of one field will be 0 if the date is not within my date range. However now I found another issue, namely that the roll Up is telling me it cannot use a calculated field. Is there a workaround for this?

    • 

      From our Eng team…

      The workaround is to do it manually from the vardef extension rather than from studio. However, this has been disabled as under some circumstances the rollup doesn’t always work correctly (I don’t recall the exact cases).  It is something that I think we should invest in supporting in a later version since there are many use cases for this.

  3. 

    There seems to be an issue when unlinking related records now in SugarCRM 7. It does not calculate automatically. You will have to edit and save the record for it to update the calculated value..

  4. 

    You can turn off the calculation in the child module. Create the rollupsum on the parent module on the calculated field in child module. Save that field. Turn on the calculation on the child field and you are set to go. This is a work around to a bug that support gave me.

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