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
How to delete unused Apex Class from developer sandbox ?ReplyDelete
I wrote some incorrect class which I need to delete from developer env.
just delete from IDEDelete
Works fine for me. Thank you so much!ReplyDelete
Unfortunately I keep receiving the error that package.xml can not be found. I did not see any hidden files when zipping files. Any advice would be appreciated!ReplyDelete
Beth, if you are using a mac, you need to create/edit the XML file a different way. I use the app Brackets to do it.ReplyDelete
I was able to solve this. Please check blog for step by step procedure..ReplyDelete