Andy in the Cloud

From BBC Basic to Force.com and beyond…

Declarative Rollup Tool Summer Release!

66 Comments

Over the course of the last couple of weeks, i have been focusing my community time on release v2.4 of the DLRS tool. Specifically focusing on some much requested features driven by the community in the the Chatter group.

So lets get stuck in…

Rollup Scheduler Improvements

The ability to run a full (or partial with criteria) recalculate of a rollup on a daily schedule has been in the tool for a few releases now. However up until now the only option was to run it at 2am everyday. It is now possible to change this with this new UI, its a bit raw and basic, but for now it should at least give some more flexibility.

RollupSchedule.png

Support for Merging Accounts, Contacts and Leads

The platform has some special handling for merging Accounts, Contacts and Leads. Especially when it comes to when Apex Triggers are invoked. Basically if your parent object is one of these objects, prior versions of the tool had no awareness of this operation, so rollups would not recalculate. If you are using Realtime or Schedule calculation modes on your rollups. Since the platform does not fire Apex Triggers for child records reparented as a result of a merge.

With this release there are two things you can do to fix this. First when you click the Manage Child Trigger button, you get a new checkbox option to control deployment of an additional Apex Trigger on the parent object. If your upgrading you will need to click Remove then Deploy again, to see this.

ParentTrigger.png

IMPORTANT NOTE: If you don’t feel merge operations are an issue for your use cases you can deselect this option and cut down on the number of triggers deployed. Also if it is only the rollup child object that supports merging, there is no need to deploy any additional triggers and the tool does not show the above checkbox option.

Secondly you need to setup the RollupJob as an Apex Scheduled job (under Setup > Apex Classes), even if you don’t have any Schedule Mode rollups. This is due to the fact that due to a platform restriction, the tool cannot recalculate rollups realtime during a merge operation. So it can only record that they need to be recalculated. It does this via the tools scheduled mode infrastructure, by automatically adding records to the Lookup Rollup Summary Schedule Items object. Note that you don’t need to change your rollups from Realtime to Scheduled mode for this to work, only schedule the job.

Support for Archived / Deleted Records via the All Rows Setting

Salesforce archives Tasks and Events after a while. If you have rollups over these child objects you can enable the Aggregate All Rows checkbox. This will ensure your rollups remain accurate even if some records have been archived. Note this also will apply to records in the recycle bin. For upgrades (if your not using the Manage Lookup Rollup Summaries tab), you will need to add this field to your layout to see it.

AllRows.png

Row Limit for Concatenate and Last Rollup Operations

If your using the Last or Concatenate operations, you can define a limit as to how many child records are actually considered when calculating the rollup. This is useful if your using Concatenate into a fix length field for example. When upgrading you need to add the new Row Limit field to your layout if your not using the swanky new Manage Lookup Rollup Summaries tab.

RowLimit.png

Improved House Keeping for Scheduled Mode

If your are using rollups with their Calculation Mode set to Scheduled. The tool records parent rollup records to be later recalculated by the RollupJob Apex Scheduled job. In past releases if through merge or other operation the parent record was deleted before the next scheduled run. Then records would sit in limbo in the Lookup Rollup Summary Schedule Items object, being processed and erroring over and over. These will now be cleared out and there is no upgrade actions you need to take for this.

Summary

Thanks for everyones support for this tool, i hope these changes help you go further with clicks not code! Though as reminder please keep in mind the best practices and restrictions listed in the README. If you have any questions you can either post comments on this blog or use the Chatter Group. The Chatter Group is a great place to get your query seen by a broader group of people who are also diligently supporting the tool as well!

You can find releases of the tool here.

66 thoughts on “Declarative Rollup Tool Summer Release!

  1. Andy, thanks so much for this truly wonderful tool. It has solved so many problems in an extremely complex SF environment, I praise your name each time it saves the day! These new additions will help even more. If you are ever in Berlin, please look me up. You have quite a few fans here in our SF developer group!

    • Thanks for your kind words! I will for sure keep your offer in mind. In the meantime please say Hi to the group from me! 🙂

  2. Hear! Hear! I agree with Alexis! Thank you, Andy

  3. Hi Andy! Love your app. On Github, the sandbox install link for 2.42 is actually the same as the production install (http://login.salesforce… instead of http://test.salesforce..)

  4. Hi Andrew, congrats for the tool. It´s really a great help you are doing to the community. I´m just starting to create by Rollups and would like to know if it´s possible to identify the last value in a child object. It´s possible to get the last date using the MIN and also the lowest value also with MIN but my need is to get in a custom object not the lowest value, but the last. In my context I want to find out the last price I sold a product.

    Do you think it´s possible.

    Thanks again.

    Antonio

  5. How can I get events count without invitees?
    I got count with invitees.

    • I am not sure of the object model from memory and not near my computer to check. But I wonder if it’s a case of doing two rollups? Also you may get more traction through posting on the Chatter group linked on the README file

  6. Andy,

    I’m trying to uninstall this and it’s impossible. It keeps saying there are 4 classes that it can’t remove and I’ve tried everything and cant remove them. Any help is greatly appreciated.

    Brandon

    • You need to use the Manage Child Trigger button on your rollups and click Remove to remove these classes.

  7. Hi. For the newer metadata functionality”Manage Lookup Rollup Summaries”, is there a way to clone an entry like there was for the older “Lookup Rollup Summaries” tab? Just wondering. It would help a lot as I have several rollups I need to do from the same object, but for now I am just doing manual entry.

  8. Hello Andy. Thanks for your answer to my previous question – that worked fine.

    I have a bit of a strange use case where I might need certain rollups on the same object to execute in a specified order (long story…). I just wanted to know if I have several rollups on the same object is there any particular order they will be executed in (like alphabetical based on name, etc.)? Or is that non-deterministic? I am just trying to weigh certain options to possibly solve a problem that there might be no solution for in any case. Thanks.

  9. Hi Andy, thank you for this amazing tool! I wish I have found this earlier.

    Thought maybe you or community here will have any ideas on the problem I am trying to solve. We need to calculate how long does it take a rep to get back to a lead after website form submission.

    I did it partially:

    1. Logged first call date/time (using Last operation) on Lead Object

    2. Created a formula field that calculates time to get back in minutes (Date_time_of_first_call__c – Form_Submission_Date)*24*60 – First_Call_Duration__c

    CHALLENGE:

    A lead submits a form today => Rep calls => Time to get back to lead gets calculated => 3 months later same lead submits another form :-/

    Date time of the first call will be outdated and time to get back will be set to 3 month which will cause inaccurate data.

    Any help or ideas would be highly appreciated!

    Thanks a lot in advance,

    Kate

    • I am afraid I have read this a few times, I am not clear on what a form is or how it affects your object model. It’s worth posting on the Chatter group, maybe with screenshots and/or diagram of your object model. The link to the group is on the readme file. Thanks

  10. You are a true Salesforce Hero. Thank you

  11. Hi Andy,
    I have had some MVPs point me to your tool. I’m very excited to try it out.
    I just tried installing it in my sandbox from the appexchange, but received a message that it had been deprecated and couldn’t be installed. I was wondering if it will be available to install soon…or maybe I just bypass that and add it to production.

    Thanks for your time!

    best,
    Julie

    • Great, hope it works out for you. Sounds like you have an old link. Got to the readme file and there is a releases section. Install the latest v2.5 link. Thanks

  12. Pingback: Declarative Rollup Tool Summer Release! — Andy in the Cloud | SutoCom Solutions

  13. Hi Andy,

    I am working in Salesforce Professional edition environment and I need this app to install there badly. I know this is not support to Professional Edition, but somehow, is there a way to make it work?

  14. Andy, maybe you can help me. We recently started receiving errors like this after merging Contact records, and it is coming from one of the DLRS triggers:
    Apex trigger dlrs_ContactTrigger caused an unexpected exception, contact your administrator: dlrs_ContactTrigger: execution of AfterDelete caused by: System.NullPointerException: Attempt to de-reference a null object: (dlrs)
    Is there any way to work around this? It looks like it is referring to a contact that was deleted because of the merge. Thanks.

  15. Hi Andy!

    What API Version is this tool for? I would love to roll up related contacts via AccountContactRelation, but that is available in 37.0 and I get an error when I try to use it as the child.

    Can you please help me?

    Thank you,

    Kelly

  16. Hi Andrew, is the latest version compliant with Salesforce TLS1.0 disablement? Thank you very much.

  17. Absolutely love this tool. however i’m experiencing an issue. i have 2 rollup summary jobs that are summing values based on an account to account lookup. 1 of the jobs is for customer record types and the other job is for partner record types. in each rollup i’m using the same field to aggregate to on the account but i’m applying a filter criteria in the where of each job checking for the specific lookup relationship to have a value. so for customers lets say its “Parent_Account__c null” but for the Partner job its “Partner_Account__c null”. my thought here is that the Parent Customer job will not touch or aggregate the field on the Partner Parent record and on the Partner Job it will not touch or aggregate the field on the Parent Customer record.

    What I am seeing is the contrary. When I calculate the customer job I see the field with the right value on the Parent Customer record. Then when i go and calculate the Partner parent job it overwrites the Parent Customer ones back to 0 even though the child accounts don’t have a Parent Customer lookup value populated (they only have a Partner Parent lookup field populated).

    • Yes this is currently by design, in order to avoid this you need to use the filter criteria on the Calculate or Schedule Calculate page, without this it processes each parent. The criteria on the rollup is only used when doing realtime calcs or Calculation Mode = Scheduled

      • ahhh perfect. that works i misunderstood how the calculate button worked and that it was to filter on the parent. thank you andy and thank you again for such a fantastic tool!

    • MattB, I’m new to the DLRS and am trying to use a RecordType as a Relationship Criteria and am getting the error that the RecordType doesn’t exist on the object (which it does). Would you mind giving me an example of your Relationship Criteria that uses RecordType?

      • I think it’s RecordTypeId

      • Thanks for your quick response. I’ve run into another issue and it looks like we may need to add some fields to work on a rollup within the same object. We are looking to create 4 levels of hierarchy in a custom object:

        Metro
        – Market
        – Community
        – Neighborhood

        There is one “parent” field that is used to create the hierarchy (Neighborhood’s parent is Community whose parent is Market whose parent is Metro)

        It appears that this passes a limit of DLRS as the Rolledup Value is zeroed out at the Community level when I activate the Market DLRS. It seems that we’ll need to use separate fields at the Market and Metro level. Does that sound right? Thanks in advance.

      • Yes you need to use separate fields. You can add them back together using formulas though

  18. Hi Andy, I just want to say that this tool is AMAZING!

    One issue that I have, though, is that when I deployed it in my org, it installed the latest version of the tool, but it is still writing triggers in 32.0. I need to access an object that is not available until 37.0; is there a way that I can write triggers in 37.0? Conversely, when I updated this tool in my Dev org, it did write in 37.0. Am I doing something wrong in production?

    Thank you!!!

  19. Hi all,
    I’m experiencing the following error from the RollupService triggerHandler: “first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record”. I suppose do to a realtime trigger event to update a parent account and I have a nightly integration bulk job performing upserts. Any advice how to overcome this? In this article they call for adding FOR Update in the SOQL but since this is a managed package we cannot: http://salesforce.stackexchange.com/questions/20921/can-anybody-explain-the-unable-to-lock-row-error.

    • any way around this that anyone knows of?

    • If could be that your child records are being inserted in parrellel under high concurrency. Are you using a data loader? If so you may have to disable parallel mode or switch to the schedule mode (see GitHub repo page and link in wiki on this) or temp disable via setting active to false on rollup records, then do your data load, then reactive and press Calculate to catch-up the roll ups

  20. Andy, If I want a job to just run on the 2nd of the month do I set the Execution Mode to like Developer and then use the Scheduled Calculate button to set the schedule?

    • Use Calculation Mode = Process Builder (I know not that obvious since your not using), then use the Schedule Calculate button and specify your schedule

  21. Andy,
    Like everyone else I love the tool. Saved my life a couple of times. I dont know how to write the relationship criteria to count cases that have been open longer than 2 weeks. I have everything set except that one formula. Can someone help me with that?

    • Thanks glad you appreciate it. I am just getting in on a flight so hard to try out for you. Take a look at this sort of idea https://developer.salesforce.com/forums/?id=906F0000000kBWeIAM. You will have to use Schedule Calculate function though as trigger mode will not work as it cannot detect the passage of time to recalc the values. Set the Calculatioj Mode to Processs Builder (even though you won’t use it from that). You can test with the Calculate button to run a full Calculate job on demand. If your still getting issues, this is just the sort of thing the Chatter group helps with (see link in the readme file).

  22. Hi Andrew, I have said I love your tool and I’ll say it again. I use it in 80% of my praojects!

    I am new to Apex but have written a Declarative Scheduling tool. It allows you set up regular schedules that will update records. An admin can then set up a process build to fire whenever the schedule is triggered.

    You can now have tasks generated for all open opporuntiities with the close date in the past and no activity in the last 14 days. Any logic you can add to a report.

    I have deisgned it to be sObject generic. It also can run up to 60,000 records at the moment (which is overkill.

    First draft. I would love any input into how it could be made better. I also think so of the declarative admins out there might find this really useful

    https://github.com/dthowell/DeclarativeScheduler

    • Hey sorry I totally missed this! Fine work my friend! I would recommend to make it easier for people to try out you create a manged package and publish it on your readme. You can encourage developers to contribute more by adding the Deploy To Salesforce button on your readme. Also people who just want the code in their sandbox can use this way if they want. Great work, love how you used an existing platform feature to drive the criteria.

  23. Hi Andrew – i was hoping to email you privately but I am not finding your contact info.
    We have a client that has to adhere to HIPA requirements. I would like to ask for your help please?

    I would like to just confirm if any process or tools in this app require that data leave the client instance and/or there are any other actions that might be HIPA compliancy issues? If data does leave client instance for a process, how is that data managed?
    Also i was not finding your app in the SF Appexchange – was it always only available here?

    thank you in advance for your quick feedback!

    • I am not a HIPA expert but can confirm it runs solely on Force.com and does not use any external services for calculating the roll ups. To configure the tool, it does call out to an Salesforce SOAP API know as Metadata API, however no data is exchanged. The package is not on AppExchange, but has gone through the security review process (see Readme file) and is available as a managed package for ease of install, management and upgrade.

  24. When merging account records, is my understanding correct in that the rollups will only run whenever the RollupJob is scheduled to run?

  25. Hi Andrew,
    JI already use the application but I have a question. Could you send me an email?
    Thank you

  26. Hi Andrew, I am trying to find and install declarative rollup helper in a sandbox and I can’t find a link to do so. Can you point me in the direction of its location?
    Thank you,
    Kathy

  27. I have received this error after creating a rollup for calls:

    Apex script unhandled trigger exception by user/organization: 005D0000009Cw8n/00DD0000000mBBO

    dlrs_TaskTrigger: execution of AfterInsert

    caused by: System.SObjectException: Invalid field Who for Task

    (dlrs)

    Parent Object: Lead
    Child Object: Task
    Relationship Field: Who
    Relationship criteria: Type IN (‘Call Attempt’, ‘Call Connect’, ‘Call’) AND (Status = ‘Completed’) AND ((CreatedDate = LAST_N_MONTHS:12) OR (CreatedDate = THIS_MONTH))

    What am I doing wrong?

    Thank you very much.

    • Also when a user now tries to log a call in salesforce they receive the following error:

      Error: Invalid Data.
      Review all error messages below to correct your data.
      Apex trigger dlrs_TaskTrigger caused an unexpected exception, contact your administrator: dlrs_TaskTrigger: execution of AfterInsert caused by: System.SObjectException: Invalid field Who for Task: (dlrs)

      • See my response on your other post to try WhoId. In the meantime you can disable your roll up be unticking the Active field

    • Try WhoId

  28. Andy, Thanks for this app – I’m getting a “2.3 has been deprecated” message on the appexchange and am unable to find v2.4. Will you let me know where we can get it for install? Thanks.

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