But, as in the blog earlier, there is no Delete button in Trigger and Apex class. So how to delete it? In this blog, I'll use Workbench to help, you can do the same using Ant migration tool.
In short, you need the same procedure as with deploying components, but also to include a delete manifest file that’s named destructiveChanges.xml and list the components to delete in this manifest. The format of this manifest is the same as package.xml except that wildcards aren’t supported.
1. Prepare the files
package.xml - you can copy and file from below:
<?xml version="1.0" encoding="UTF-8"?>
destructiveChanges.xml - make sure 'C' in capital
<?xml version="1.0" encoding="utf-8"?>
Put both files above in a folder, zip the files (without folder) and name it as package.zip. For the name tag in the file above, see Metadata Types.
Login to Workbench, select Migration | Deploy, select the zip file and enable both 'Rollback On Error' and 'Single Package'.
Click Next button button to continue, then Deploy button to proceed.
Wait for deployment, normally will take less than 1 minute. Once finish, you will get the result -- done and check the status.
- An Easier Way to Delete Apex Classes From Production
- Deleting Files from an Organization
- Metadata Types