Use case:

Job that runs hourly and in finish(), uses Andrew Fawcett's Custom Metadata Services to update Custom Metadata with some job details.

This works fine in one sandbox and in PROD but for some reason in the QA sandbox, the hourly job has dozens of pending deploys, one per hour, going back months - see screen shot.

The problem

I'd like to cancel these deployments but using the UI to cancel 1x1 is sooo painful that there has to be an easier way.

There is a method in the Metadata API (cancelDeploy(jobId)) that does the trick but I haven't found a tool that will allow me to invoke this (not supported by Workbench, nor ApexWrapper for MD API for example)


The 0Af prefix is apparently a DeployRequest object - not documented anywhere. Trying to query in Tooling API:


results in INVALID_TYPE

enter image description here

  • 1
    You can use Metadata Toolkit's cancelDeploy method, but you still need a list of deployment Ids, which I'm not entirely sure how to get a hold of short of screen scraping; the API documentation is strangely silent on how to get a hold of the ID values, or at least it's not in an obvious place. – sfdcfox Feb 22 '18 at 20:32
  • @sfdcfox - Metadata Toolkit ? what is this? is it something installable? – cropredy Feb 22 '18 at 22:39
  • Sorry, the "Ant Migration Tool". It's a great little tool for CLI stuff when you don't need a UI, and happens to be a pretty good way to do stuff that's hard to do otherwise. – sfdcfox Feb 22 '18 at 22:46
  • @sfdcfox - ah thanks - I see cancelDeploy was added as of V34 in Ant Migration Tool; too bad no way to query for these DeployRequest objects – cropredy Feb 23 '18 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.