I’ve created a custom object in a developer edition org with the sole intention of deleting it via the Metadata API as per Deleting Components from an Organization.
To do this I created the following files:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <version>33.0</version> </Package>
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>DFB__ObjectToBeDeleted__c</members> <name>CustomObject</name> </types> </Package>
Then zipped them both into destructiveChanges.zip.
I uploaded the resulting zip file to the Workbench Metadata Deploy page and deployed it.
The processing status came back as successful.
However, the custom object is still present and there is no indication that it has been deleted.
- both with and without the namespace prefix for the member name in the destructiveChanges.xml.
- change the package manifest version to be 32.0 to match the version that Workbench is using.
- checking Purge On Delete in the Workbench deploy options.
- both including and excluding the
versionelement in the destructiveChanges.xml.
Why can’t I delete this custom object using destructive changes?
It turns out the following DeployOptions setting was what I was missing:
Indicates whether the specified .zip file points to a directory structure with a single package (true) or a set of packages (false).
I needed to set this to true, as I assume my flat zip file represents a single package. After doing that the Number of Components Deployed became 1 and the custom object moved into Deleted Objects (as I hadn’t checked purgeOnDelete).