Sunday, 14 June 2015

Bulk Deleting Reports - The best way?


One of this week's many Salesforce challenges was to clear out 2,000+ old reports from a client's ORG which were not longer required and were just taking up space. None of the reports had been run in over a year and were seriously cluttering up the place.

It turns out that there are multiple ways of accomplishing this so I thought I'd write up the various options.

Clearing out

In preparation for the clear out I avidly followed the tips given on the following blog posting.

https://success.salesforce.com/answers?id=90630000000gt4gAAA
and this one:
http://www.buttonclickadmin.com/spring-cleaning-simplifying-your-salesforce-reports/

In short the approach was to
  1. communicate to users what you are doing with old reports, 
  2. send a targeted email to all users who have reports that had not been run in a year
  3. move those reports into a folder called "Reports to be deleted"
  4. then, find the best way of deleting them

So many options

Having moved all of my reports into a single folder I thought all of the hard work was done. However, actually clearing them out proved to be trickier than I thought. I'll run through the options I tried below.

1. Individually delete the reports

Hover your mouse over each report and delete manually. Good for smaller numbers of reports but this approach would take a very long time to delete a large number of reports.

2. Using Eclipse IDE

There were several blog postings outlining how you could use Eclipse to delete reports.

The steps outlined were:
  • log into Eclipse (I am using Kepler edition)
  • download the report folder you want to delete
  • delete the folder within Eclipse
  • then select "deploy to server" to synchronise your changes back in your live ORG
  • Once the deploy process is complete the folder should no longer be visible in your Salesforce ORG.


I tried individually deleting reports in Eclipse and also deleting a whole folder of reports but after deploying to server I could still see the reports and report folder in Salesforce. 

Strangely though, when I went to open any of the reports in that folder I would just get a blank page. When I refreshed the page the report would then actually disappear. This could have just been a bug with my Eclipse installation but that, and the fact that each deploy process took a good 15 - 20 minutes to complete, meant that I still had many more reports that needed removing.

Here are a couple of links to forums discussing Eclipse IDE and Report deletion in more detail.


3. Using Data Loader

I saw several blog postings discussing whether Data Loader could be used to delete reports in a similar way that it can be used to mass-delete Leads etc. 

Unfortunately the Report Object is read only via the API so this turned out to be a false start.

4. Using a Bat file

One interesting comment on this forum post mentioned the URL that is generated when you delete a report manually from within Salesforce.com - https://na1.salesforce.com/(report Id)?delrep=1


I tried this blog's idea of creating a Bat file with a long list of these URLs with the Report ID of an obsolete report and then running the command from my windows desktop.

Each URL from the Bat file opened in sequence in my browser in a new tab so it took a few minutes to complete the operation but it was successful in deleting the reports.

The format of the Bat file was:

@echo off 
start /d "" IEXPLORE.EXE https://na1.salesforce.com/01ZD000000172gK?delrep=1 
start /d "" IEXPLORE.EXE https://na1.salesforce.com/00OD0000006VFmm?delrep=1

I also found a really useful posting explaining how you could generate a JavaScript or VB script to achieve this same outcome.

http://stackoverflow.com/questions/188850/how-to-launch-multiple-internet-explorer-windows-tabs-from-batch-file.

5. Using Salesforce's Mass Delete Records feature

Prior to Summer 14 version of Salesforce options you only had options 1 - 4 to consider. Luckily, and possibly due to the amount of forum postings and ideas on the IdeaExchange platform Salesforce.com now has a mass delete tool available out of the box.

To bulk delete reports go to Administer Data Management / Mass Delete Records

On the option screen select Mass Delete Reports.


You will then see a screen that lists the first 250 of your reports. To find the reports that need deleting you can add a number of filters at the top of the screen. If you have already moved your reports into a folder called "delete" then just a simple search for "Folder contains delete" should bring you back the first 250 of your reports in that folder.


To delete the reports, either select each one individually or use the select all option at top and click Delete. The report will then be moved into your Recycle Bin.

Things to note:
  • Personal reports of other users, reports used in dashboards or reporting snapshots are not deletable through mass delete.
  • You can only delete 250 reports at a time.

None of the above? Log a call with Salesforce.com support

If all of the options above seem daunting then you could also request support from Salesforce.com in deleting your reports, particularly if your company is signed up to their Premier success plan. 

Once you've raised a case, one of their support team would either talk you through deleting the reports yourself or may even do it for you. 

Conclusion

I found the Mass Delete tool within Salesforce was the easiest of all of the approaches to use but the 250 report limit could be frustrating. The next time I have to delete a significant number of records I think I will try Eclipse again and use the Mass Delete Tool as a fallback.

How do you purge your reports en mass? Did I miss any tools out? Which one is your favourite and why?

Happy deleting!