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.

Custom Object To Be Deleted

To do this I created the following files:


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

Then zipped them both into destructiveChanges.zip. Destructive Changes Zip

I uploaded the resulting zip file to the Workbench Metadata Deploy page and deployed it.

The processing status came back as successful.

Workbench Metadata deploy result

However, the custom object is still present and there is no indication that it has been deleted.

I've tried:

  • 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 version element in the destructiveChanges.xml.

Why can't I delete this custom object using destructive changes?

Note that this will ultimately be part of a much larger set of deletions. I could potentially use deleteMetadata(), but I'd rather figure out what is wrong with my deploy() call.

  • Looks good, must be something really trivial! Is it possible the script is using username and password for different org? Or maybe there is a switcheroo between destructiveChanges.xml and package.xml? Commented Mar 22, 2015 at 23:42
  • @bigassforce Yes, I think I've got tripped up on something stupid. I've started doing things like checking the double quotes are correctly encoded in the XML. Commented Mar 22, 2015 at 23:44
  • Do you get the same result with the actual ant force.com migration tool? Commented Mar 22, 2015 at 23:46
  • I don't know, I'll try. I've mostly just used the APIs directly, which is why I was using Workbench to rule out anything I've done. Commented Mar 22, 2015 at 23:49

1 Answer 1


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).

  • 3
    Your description of process and your self-posted solution were very helpful for guiding me through my first destructiveChanges.xml deployment. Thank you for your thoroughness!
    – smohyee
    Commented Jul 27, 2015 at 20:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .