Ability To Remove Deleted Cases From Business Insights

Last Updated -


We've heard that a lot of our customers want to remove deleted cases from Business Insight reports. While there is no product feature to achieve that at this point, we have found a workaround that can help you exclude deleted cases from reports. And it's easy!

The idea is to add a “Deleted” label to all the deleted cases and exclude the cases with “Deleted” label in your reports. But case rules won't run on deleted cases to append labels, we will have to work with our API to update the case label.

(Note: this will only work if the case is not permanently deleted. )


This script is written in Ruby and requires at least version 2.1.2, or above. To check which version of Ruby you have installed, simply run ruby--version in a terminal.
If you have an older version installed, it's very easy to upgrade and manage different versions with the Ruby Version Manager (RVM). Please see the RVM website for installation instructions.

Note: Using RVM to manage your Ruby installations is highly recommended.


  1. Download the sample code (see attachment)
  2. Navigate to the folder in a terminal and run these commands:
  3. gem install bundler
  4. bundle install
  5. Edit update deleted_cases.rb to include your credentials


Now run the following:

ruby update deleted_cases.rb

You will see a progress bar while this is running. If there is any error, open the error.log

You are done! Once the script is completed, all the deleted cases will have “Deleted” label and you can now filter out these cases by filtering labels in Business Insights.