Ability To Deleted Cases When The Case Is Deleted In Salesforce

Last Updated -


It's our product design that Desk Connect doesn't sync deleted cases. But we understand that sometimes you want the cases in Desk to be deleted if they are deleted in Salesforce. We have a workaround for that.


  1. Create a case custom field in Desk with custom field key “delete_case”, make sure to select “True/False” as the custom field type.
  2. Create a case custom field in Salesforce “Delete Case” for the corresponding custom field in step 1.
  3. Set up Desk Connect to map these two fields in step 1 and 2.
  4. What happens next is:
    1. If a case is created, you can set the value of the custom field “Delete Case” in Salesforce to true manually or use process builder/apex to achieve the automation before you delete the case.
    2. Then this custom field will be synced over.
    3. We have created a script which will help you to check if the “delete_case” custom field is true, it will delete the case. Please see the detailed steps below to achieve that.
    4. Then you can delete cases in Salesforce.


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 delete_cases.rb to include your credentials


Now run the following:

ruby delete_cases.rb

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