Ability To Deleted Cases When The Case Is Deleted In Salesforce
Last Updated -
OverviewIt'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.
- Create a case custom field in Desk with custom field key “delete_case”, make sure to select “True/False” as the custom field type.
- Create a case custom field in Salesforce “Delete Case” for the corresponding custom field in step 1.
- Set up Desk Connect to map these two fields in step 1 and 2.
- What happens next is:
- 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.
- Then this custom field will be synced over.
- 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.
- 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--versionin 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.
- Download the sample code (see attachment)
- Navigate to the folder in a terminal and run these commands:
gem install bundler
- Edit delete_cases.rb to include your credentials
UsageNow run the following:
You will see a progress bar while this is running. If there is any error, open the error.log. You are done!