Do dynamic rollups using Sugar Logic

sugarcrmdevelopers —  May 22, 2012 — 3 Comments

We got a great question from our partner developer, Enrico Simonetti with InsightfulCRM, a while back around Sugar Logic…

I have a quick question for you about rollup fields.
I have not used them much, but I suspect they are actual custom fields that get stored against the record/module. Correct me if I’m wrong!
Is there a way not to store the value but to just do a “runtime lookup” without code level customizations?

And he is correct, by default Sugar Logic does the calculation on record save and pushes it to the database, as most often the use-case is that the value dependencies change only on a record save, so there’s no sense in requiring the overhead of re-running calculations all the time. But in a rollup case, there is a pretty good case where having a “runtime lookup” would be more helpful.

In the past, you could do this via after_retrieve logic hooks and custom PHP code for doing the lookups. But as our Sugar Logic guru points out, there’s another way to do this same thing thru a metadata Sugar Logic implementation, which is far more compatible and easy to do. So for something like adding a rollup for the Contacts module of related Cases, try out this Sugar Logic formula…

3 responses to Do dynamic rollups using Sugar Logic

    Jacob Swanner May 29, 2012 at 11:16 pm


    Excellent read I just passed this onto a colleague who was
    doing a little research on that. And he actually bought me lunch because I
    found it for him smile So let me rephrase that: Thanks for lunch!

    Kostya Kostyushko April 8, 2013 at 6:18 pm

    Hi, I’m trying to refresh the total price of my parent module when price on one of it’s child was edited. I tried to apply the same logic described on this post, and it doesn’t work.
    One of the possible problem I found, is that the field name for the price on the quick edit panel of child, and on the parent view are the same.
    Is there any way to do ajax update of the rollup sum according to modules child changes?

Trackbacks and Pingbacks:

  1. Case SLAs and calculated fields - June 30, 2012

    […] […]

Leave a Reply

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

You are commenting using your 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