How do you delete or deactivate the apex classes / triggers on your Salesforce Production Org? Unfortunately, it is not as simple as going to the Apex class and hitting the delete button or unchecking the ‘Active’ checkbox.

For deleting or disabling the code, you can take one of the following two routes:

1. Probably the simplest way to delete / disable is to connect to your Salesforce production org from VS Code download the apex class / trigger, change the status of the Apex class / trigger to “Deleted” or “Inactive” in the class/trigger XML file and save. In this step-by-step guide we are going to cover this method.

2. The 2nd way is to use ANT Migration tool and here is the link to a knowledge article on how to use this method.

(If you are not familiar with ANT Migration tool here is just the guide you need – Step-by-Step Guide on Getting Started with Salesforce ANT Migration Tool)

To download a PDF copy of the presentation above

check to receive weekly updates on more of such awesome guides

(You'll never be spammed on my watch. And that's a promise)

Blog Change Log:

  • 04-Jun-2021 – Reviewed and revised the guide using VS Code, Salesforce CLI & Salesforce Extension Pack
  • 05-Apr-2014 – 1st Published using Eclipse & IDE