Automated Error Alerts and Mass Delete Error Records

I have seen people posting about their scheduled rollups failing and them not finding out about it until later.  Well DLRS has this nice section called Lookup Rollup Summary Logs and it is just a table that holds records of failed scheduled rollups.  This is good news it means we can create a custom report type and then build a exception report so that whenever one of these fails it will trigger and alert us.

First go to Setup and look for Report Types

Then click on New Report Type

Now we need to name the new report type, give it a description and then where we want it to be stored.  I store it under Admin Reports as I am most likely the only person in the Org who will care about DLRS errors 😉  (Pro-Tip make sure you deploy it once you have it made.  You can do that now with the radio buttons at the bottom or you can do it after you save the report type. Just don’t forget to Deploy it!)

Next we only need the main table so we don’t need to set up any table joins so we just click on Save.

Now when we go to Reports we can look for the DLRS Error Report Type

Click to create a new report.  And then build your Report. I keep my report pretty bare bones with just the Log Name so I can go directly to the records.  Feel free to set up as much or little information in your report.  Then I want it to show me ALL records as anytime there are DLRS errors and I fix the problem I clear the table so it doesn’t end up taking up storage space.  If you don’t clear your table you could say that it should only look at records created Yesterday or some specific time frame.

Next is we want to subscribe to the report.

For me I set it up to run every weekday at 8am and if the record count is ever greater than or equal to 1 it will shoot me an email and I will know that one of my scheduled DLRS’s failed.  Click save and you are good to go.

The second part is the two ways I clear my DLRS Error Log Table.  First is I built a small Javascript button (RIP JS Buttons in Lightning.  I think this can be done with Quick Actions but I have not had time to look into it.  I’ll update this post later once I figure out how to do this same trick in a Lightning Friendly way) and added it to the list view of the DLRS Error Page.  To do this you’ll want to go to Setup > Create > Objects and look for Lookup Rollup Summary Log.  Go into the object and scroll down to the buttons and click on create a new button.  Below is the code I use.

{!REQUIRESCRIPT(“/soap/ajax/36.0/connection.js”)}

var url = parent.location.href;

var records = {!GETRECORDIDS($ObjectType.dlrs__LookupRollupSummaryLog__c)};

if (records[0] == null) { //if the button was clicked but there was no record selected

alert(“Please select at least one record to Delete.”); //alert the user that they didn’t make a selection

} else { //otherwise, there was a record selection
alert(“Deleting ” + records.length + ” Records. Press Ok and wait for the page to reload.”);
var result = sforce.connection.deleteIds(records);
parent.location.href = url; //refresh the page
}

Once you have your new button you’ll just need to click on the Search Results under Search Layouts and add the button.  Then it should appear and you can use the button to delete many at a time in a list view.

The other way I clear the table if there are TONS of error log records is export all of the record ID’s with Dataloader then load them back in as a delete command with dataloader.  You can use the Bulk API so it can clear the table pretty quickly.  Until next time when I hope to finish writing up how to create a simple account health warning system with Process Builder, DLRS and some workflow rules.

6 thoughts on “Automated Error Alerts and Mass Delete Error Records

    1. Dan Post author

      Digging into this it seems like it has to be a custom VF page. I’ll try and get one up and working next week.

      Reply
      1. Dan Post author

        Well digging into it this is a quick and easy way. Go to the app exchange and look for Mass Delete. It is a salesforce labs package.

        https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016YuDEAU

        Install that then go to any of the visual force pages it installs and copy one of them and rename it to be DLRS_Mass_Delete.

        The only thing you need to edit in the code is on Line 1 there is

        StandardController=”Account”
        [Where it says Account it will say whatever page you copied could be Lead, or Contact or whatever standard object page you copied.]

        Change that to be
        StandardController=”dlrs__LookupRollupSummaryLog__c”
        then save it. Now go create a new button have it launch a Vforce page it should auto find the Vfpage you just made and boom good to go!

        Reply
  1. Jeff Sieck

    Thanks for Posting this. When I checked the syntax for the JS Button, I got an error: Syntax Error with the (“/soap/ajax/36.0/connection.js”)} line highlighted. I changed the smart quotes to regular quotes (“) and it worked. Just letting you know!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.