Skip to main content

How to Delete the Deployed Apex Triggers from your Salesforce

Updated over 2 months ago

Note: There are several ways to delete deployed Apex triggers in Salesforce. The method described below uses the Workbench application.

Step 1: Create destructiveChanges.xml

This file lists the Apex triggers to delete. Example:

********************************************************************************

<?xml version="1.0" encoding="UTF-8"?>

<types>

<members>TriggerName1</members>

<members>TriggerName2</members>

<name>ApexTrigger</name>

</types>

<version>60.0</version>

</Package>

********************************************************************************

Replace TriggerName1, TriggerName2 with your actual trigger API names.

Step 2: Create package.xml

Even for deletions, this must be present (can be empty):

********************************************************************************

<?xml version="1.0" encoding="UTF-8"?>

<version>60.0</version>

</Package>

********************************************************************************

Step 3: Zip the Files

Create a .zip file (e.g., deleteTriggers.zip) with the two files at the root level:

  • deleteTriggers.zip

    • package.xml

    • destructiveChanges.xml

❗ Do not place them inside a subfolder.

********************************************************************************

Step 4: Deploy Using Workbench

  1. Login with your org using credentials.

  2. Navigate to: Migration > Deploy.

  3. Choose your zip file (deleteTriggers.zip).

  4. Set the following options:

    1. Rollback On Error: Checked

    2. Single Package: Checked

    3. Test Level: RunSpecifiedTests

  5. Click Deploy.

********************************************************************************

Step 5: Validate the Result

Check the result. If successful, the triggers will be deleted.

Important Notes:

  • Make sure the API version in the above files matches the version you select in Workbench.

  • Ensure the triggers aren't referenced in active flows or Apex classes.

Did this answer your question?