Delete Failed vRO Workflow Runs

If you have worked with vRealize Orchestrator 7 you'll probably have a love/hate relationship to the long-lived Java client.

vRO 8 deprecated the Java client and we're left with the HTML5 interface (yes, I know that you might be able to use the old client for some operations still..). The switch has been a bit of the struggle for some of us, but now I've gotten used to the HTML client now and started to enjoy it.

Still, there is some features missing in the HTML UI, one of those are the "Delete all finished workflow runs"

Delete finished workflow runs in old Java client

I like to keep the Workflow Runs screen free of Failed runs as this will give me an easy way of seeing if some workflows are failing when logging in to the dashboard.

When doing a lot of testing it's quite handy to re-run workflows to keep the input parameters, but it's a pain to always remember to delete those failed runs. This could quickly leave you with a screen like this

Dashboard with lots of failed workflow runs

And a list of ever growing failed runs

List of failed workflow runs

As far as I've seen there's no built-in action or workflow for deleting a lot of runs, we're left with clicking through each and every failed run.

To rectify this I decided to look into creating something that could help me delete multiple runs. Let's take a look at how we can accomplish this

vRO workflow object

vRO has an object type for it's Workflows.

vRO Workflow object

A workflow run generates a Workflow token

vRO Workflow token object

Unfortunately none of these have a method for deleting workflow runs. We can however get the state of a Workflow token which we can use for filtering the failed runs

But how can we delete those failed runs?

vRO API to the rescue

vRO has an API which has a lot of possibilities not built into the Objects available to us.

To check out the API documentation for your specific vRO instance you can use the Swagger documentation found at https://<fqdn>/vco/api/docs

In the Swagger doc I found a Delete workflow run method which seems to fit my use-case.

vRO Api Swagger documentation

The API method takes two parameters, the Workflow Id and the Execution Id, both of which we can fetch with the built-in Workflow and Workflow Token object.

Rest client in vRO

There's multiple ways of working with the HTTP REST plugin in vRO. If we're using vRO with vRA the vRA Host object actually has the possibility to create a REST client directly from the vRA Host object which also takes care of authentication

Create REST client from vRA host

The REST client has methods for creating and exectuing requests which we'll make use of.

If you're running vRO standalone you'll have to take care of creating the REST client and handle the authentication yourself.

Delete Failed Runs Workflow

Let's take a look at the final workflow.

The workflow takes one input parameter, the Workflow object. In addition there's a variable for holding the vRA Host object.

The actual code for deleting failed runs of a specific workflow fits in a Scriptable task

 1var executions = workflow.executions;
 2var client = vraHost.createRestClient();
 4for each (var run in executions){
 5    if(run.state === "failed"){
 6        System.debug("id: " +
 8        //Build REST request
 9        var path = "/vco/api/workflows/" + + "/executions/" +;
10        var request = client.createRequest("DELETE", path);
12        var response = client.execute(request);
13        System.debug("statusCode: " + response.statusCode);
14        if(response.statusCode !== 204){
15            System.error("Couldn't delete workflow run " + + ", status message: " + response.statusMessage);
16        }
17    }

If we run this workflow we get to choose the Workflow we want to delete runs from, both name and Workflow Id works

Run workflow

Workflow status

The code in the Scriptable task should probably be moved to an Action, but for the sake of simplicity I've left it as is for now.

The workflow works with one Workflow and it's runs/executions, if you'd want to delete all failed runs for all workflows you'll have to iterate through all of the workflows, but this should be doable.


This post has shown how we can make use of the vRO Api, and the vRA Host object, for handling those Failed workflow runs.

Note that you should be careful with deleting stuff, and of course do not delete workflow runs that contains useful troubleshooting information.

Thanks for reading!

This page was modified on March 17, 2022: Added thumbnail