Andy in the Cloud

From BBC Basic to Force.com and beyond…

308 thoughts on “New Tool : Declarative Rollups for Lookups!

  1. Eeeeeeeek! This just saved me. I’ve been trying to figure out a solution on my own for weeks and after enough googling, I stumbled upon your post and your solution. Thank you so much for sharing this with the community!!!

    FYI – here’s the scenario I’ve been struggling with that this solved: We have created an opportunity hierarchy using a Parent Opportunity lookup field. We want to be able to report on the total value of child opportunities on the parent opportunity. This tool worked perfectly.

    [doing a happy dance]

  2. Hello Andrew,

    Is your tool work with standard objects like AccountTeam or opportunityTeam?

    Thx

    Regards,

    • Yes, some only work in scheduled mode though. Try it out and raise issues in the Chatter Group linked on the readme file.

  3. Please Help! I am unable to get this to work in my sandbox. When I attempt to Calculate I get an error indicating the Rollup must be “active” but I am not seeing anywhere to set it as active or not??

    • Also I find it strange that when I try to use the Enhanced Edit – the Child Field to Aggregate picklist does not contain the field on the child object that I want to summarize – I am able to specify it when I create the rollup…but it is not available in this enhanced edit mode.

      • This could be a bug. Have you seen that there is a Chatter Comminity group linked on the Readme file. Lots of help in that group also. You can also search for known issues on the GitHub page for this tool. Finally try to use the Manage Rollup Summaries tab this is the recommended way to define rollups and is backed by custom Metadata that allows you to migrate your rollups via change sets

    • This is a field on the rollup definition

  4. Ok – I think Im on the right track now…seems I installed a WAY old version of the tool. Updated it and am currently waiting for the first calculate job to complete – THANKS!!

  5. I am using Account and a custom child object. I can’t get it to work in Real Time, but I can get it to work when I do Calculate and put in a simple Name LIKE … query. Is there something I could be leaving out ? It’s activated, and I have indeed chosen Real Time. I’m not using any of the optinal fields such as Relationship Criteria or Relationship Criteria Fields.

    • In realtime mode the tool needs to know what fileds to watch for changes in. By default this is the field your aggregating. So if that changes the realtime recalc will be done. If your changing other fields, you need to list them in the Child Relationship Fields field (if you don’t have a filter).

  6. ah ok – that makes sense. So I guess it will work in Schedule then ?

  7. Hi Andrew,
    Thanks for sharing. I have a difficulties with deploying Apex Trigger. Would you please advise of how to resolve this issue?

    Error:
    dlrs_SCMC_Production_OrderTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Item is required: [SCMC__Item_Master__c] Class.dlrs.RollupService.testHandler: line 272, column 1 Class.dlrs_SCMC_Production_OrderTest.testTrigger: line 11, column 1

    Warning:
    dlrs_SCMC_Production_OrderTrigger:Test coverage of selected Apex Trigger is 0%, at least 75% test coverage is required

    • Take a look at the wiki on the GitHub repo it has an article around code coverage and test code needed in cases like this. The default test code the tool generates does not comply with the validations in your child object.

  8. We are using this to calculate a value that is an ‘average’. (i.e. the average number of match items for all child records in a group). The values returned are frequently more than 2 decimals, however, and we want to display them in an email {mere field} with 2 or less decimals. The Salesforce fields show 2 decimals when viewed on the account or in reports, but the merge field is pulling more. How can we limit the output from the rollup summary so the merge field displays correctly?

  9. HI Andy
    I am getting error when i deploy the code. code coverage is not done please can you help me.

  10. Hi Andrew ,

    is there any limit with this app.

    i am not getting new button after clicking on lookup rollup summary tab.

    thanks
    rajni

    • There are two ways to create rollups. Recommended is via the “Manage Rollup Summaries” tab. This supports custom Metadata and allows for easier migration of rollups from sandbox to production. The “Lookup Rollup Summaries” tab is the original option. You must manually copy over rollups from sandbox to production here. If you do want to use that option, keep in mind when opening that tab to see New you need to click Go and have the correct permissions assigned, these are permissions sets under setup for the tool. Hope this helps.

  11. Hi Andrew, this has proved VERY useful!

    I’m not the most experienced with this stuff, I’ve got a Roll-up to sum all “donations” (a custom object) for an activity but can’t find a way to make the same field but only for those ‘donations’ within a time frame, I.E a financial year. I’d love to be able to set it up and it update the dates for the FY each year rather than enter dates every April, but I can’t even get it to understand “equal to or greater than ___ date and Equal to or less than ___ date.

    Any ideas?

    Thanks so much for this AMAZING tool! 🙂

  12. Hi Andy,

    I am trying to rollup Article (child) information to a Case (Parent) custom field but I get an error:
    Error:
    triggers/dlrs_CaseArticleTrigger.trigger (Line: 4: Column:36) : SObject type does not allow triggers: CaseArticle

    Cases can have multiple articles attached. I want to capture the date/time of the article that was created the last one.
    Salesforce stores this information in the CaseArticle table and the Rollup Helper tool displays it but it does not work well in our org.
    Knowledge Articles do not support triggers, so this is where the error may come from?

    Thank you for your support!
    Julian

    • Same error message appears when using the API name of my article type (HSM_Article__kav):
      Error:
      triggers/dlrs_HSM_Article_kavTrigger.trigger (Line: 4: Column:40) : SObject type does not allow triggers: HSM_Article__kav

      The strange thing is that in both cases I also get, right below the error message, another message saying “Deployment Complete”

      However the roll ups do not work

    • Yes this is correct, your only other option is to use the full schedule recalc mode. See the wiki article on the GitHub project for more.

  13. Hi Andy – This is a fantastic product and I am finding a number of uses for it. Thanks for creating this. Gotta question for you. In the scheduled job, I’ve added a filter “Rep_Type__c = SOB AND Status__c = Active”. After saving, the filter no longer shows. Only the example “Name LIKE ‘Fred%’ AND Custom__c > 0” shows. Even though it doesn’t show, will my filter still apply to my scheduled jobs?

    • Yep it will

      • Thanks. One last question. I am rolling up sales rep activity onto a custom object called Agent. There are 6 fields which I rollup data to (calls, quotes, sales, etc.) Each sales rep has 2 Agent records. One for Inbound work and the other for Outbound work. When the trigger fires, some of the data gets added to the Outbound record and the other data is added to the Inbound record. For example, calls and quotes get added to the Outbound record and sales # gets added to the Inbound record. Is there a way to set it up so that only the Outbound record gets updated with all of the data? Or, is there a way to update both records with all of the data?

      • So you have Custom object > sales rep > outbound and Custom object > sales rep > inbound object relationship? If so you need to define a rollup between each relationship to bubble the information up to the custom object you need

  14. Hi there and thanks so much for this awesome tool. I am using it for the first time and although I think I set this up correctly it seems that the rollup isn’t populating. Basically I created the rollup and have connected it using the manage child trigger. I have set all the fields and checked the code in my relationship criteria and listed all of the criteria fields on seperate lines, the rollup summary saves and is activated. The figure isn’t showing up and not sure why, I created a lookup link and a new custom object to place these rollups and its still just blank in there.

    Its a one person team here from a primary school in new york so any help and steps much appreciated.

    Any help much appreciated.

    • Also I should add i used a currency field as the field that will be rolled up to should I have used a text field?

    • Do you have a realtime rollup or scheduled? If it’s the later check the wiki on the GitHub repo for further instructions.

      • Thanks! OK so this is working now, amazing. I do have another issue though. I am using a process builder to update the lookup field I have with the same id each time a record is created so I can roll-up these figures to a specific object. That works great up to a point but once I tried to add a couple more I am getting an error and the records cannot be saved at all. When I delete the newly made roll-ups it works again.

        Is there a limit to how many roll-ups I can create before process builder cannot update the field it needs to? Its such an odd issue but I do have about 35 roll-ups currently. If I were to schedule to roll-ups would I have more success do you think? They only need to run once a month. I have the error message here below if you think its useful to see.

        Error Occurred During Flow “PRRU_000001date_Purchase_Request”: The flow tried to update these records: nul…

        Error element myRule_1_A1 (FlowRecordUpdate).
        The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_Purchase_Request_FormTrigger: System.LimitException: dlrs:Too many SOQL queries: 101. For details, see API Exceptions.

        This report lists the elements that the flow interview executed. The report is a beta feature.
        We welcome your feedback on IdeaExchange.

        Flow Details
        Flow Name: PRRU_000001date_Purchase_Request
        Type: Workflow
        Version: 1
        Status: Active

        Flow Interview Details
        Interview Label: PRRU_000001date_Purchase_Request-1_InterviewLabel
        Current User: Aaron Louie (005G0000007BpTo)
        Start time: 9/19/2017 12:42 PM
        Duration: 1 seconds

        How the Interview Started
        Aaron Louie (005G0000007BpTo) started the flow interview.
        Some of this flow’s variables were set when the interview started.
        myVariable_old = null
        myVariable_current = a4s0f000000XyTaAAK

        ASSIGNMENT: myVariable_waitStartTimeAssignment
        {!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
        Result
        {!myVariable_waitStartTimeVariable} = “9/19/2017 12:42 PM”

        DECISION: myDecision
        Executed this outcome: myRule_1
        Outcome conditions: and
        1. {!formula_myRule_1} (true) Equals true
        Logic: All conditions must be true (AND)

        RECORD UPDATE: myRule_1_A1
        Find all Purchase_Request_Form__c records where:
        Id Equals {!myVariable_current.Id} (a4s0f000000XyTaAAK)
        Update the records’ field values.
        Purchase_Request_Roll_Ups__c = a2D0f0000016gw2
        Result
        Failed to update records that meet the filter criteria.

        Error Occurred: The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_Purchase_Request_FormTrigger: System.LimitException: dlrs:Too many SOQL queries: 101. For details, see API Exceptions.

        Thanks again for this amazing tool

      • This is a platform limit the tool cannot avoid. Generate a debug log and review it carefully or use the dev console and use the Execution Overview pane. What I think is happening is some recursion causing the trigger to fire over and over until the governor fires. Other option maybe to use one of the schedule modes (see wiki before using schedule modes).

  15. I’m having the same challenge with my rollups that aren’t populating. I have one date/time field and two text fields. I suspect it is the aggregate operation perhaps. I’ve tried first, last, concatenate. The others (sum, max, min) gave errors and wouldn’t allow me to select/save the rollup until I changed it.

    I am using this for two custom objects that had a master/detail relationship. When the rollup wasn’t working, I created a lookup relationship between them, but still no luck.

    Any suggestions?

    Thank you,
    Helen

    • I would advise going back to the rollup summary the platform provides and trying that again it is always going to perform better than this tool tbh

  16. Does this work between two custom Objects? I have been trying to get it work between two custom objects but no luck. it works like magic when I chose one of the standard object (wither Parent or Child). could not find anything related to it in the documentations as well. Please suggest.

    • Yes works with two custom objects. Drop your error in the Salesforce Community Group, I and many others can help out then

  17. Hello Andrew,

    We have more than 3 millions records in the object ‘Lookup Rollup Summary Schedule Item’ and i see that this object is used only to keep history, we use declarative lookup between two customs objects and we want know if we can truncate this object because all our fields are filled on the parent object? could you confirm this?

    Regards
    Nadir

    • Yes you can. This object drives the incremental rollup recalcs when using the applicable schedule mode. So it looks like the schedule job is not clearing these or it’s not scheduled. Take a look at the wiki article on the GitHub repo for an explanation of the schedule modes. It sounds like if you have not noticed any rollups not calculating you may have a rollup that’s not needed but still outputting entires that are not needed?

  18. Andy,
    Are the triggers that are deployed bulkified? We are running into issues here with Too Many SOQL Queries and the like. I am just reaching out to any vendor that has triggers as part of our managed packages to double-check. Thanks.

    • Yes they are. But… if you have multiple rollups, over different parent objects, different criteria this does end up using different queries, since these cannot be combined into one.

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