Generate vRO Workflow Runs Report in CSV

A workflow that pulls the last 30 days of Orchestrator workflow runs from the catalog REST API, turns them into a CSV report and emails it to you. Updated and tested on VCF Operations Orchestrator 9.1.1.

In this article

Sometimes you need to keep an eye on workflow runs in Orchestrator: how often a workflow runs, who started it, how many runs failed, or how long a run takes. I’ve had a few customers ask for exactly this, so here’s a small workflow that collects the last 30 days of runs and emails them to you as a CSV report.

Tested on: VCF Operations Orchestrator 9.1.1 (REST API and CSV code, Nov 2026) and vRealize Orchestrator 8.x (original package, 2022).

Understand the REST API

Orchestrator has a REST API for almost everything, including workflow runs. There are a few ways to get this data, but the catalog-service-controller is the quickest for this use case. It can query many kinds of objects, and the one we need is GET /api/catalog/{namespace}/{type}.

The catalog-service-controller GET /api/catalog/{namespace}/{type} operation in the Orchestrator API Explorer

With namespace System and type WorkflowToken, this call returns every workflow run that completed or failed between two dates:

/api/catalog/System/WorkflowToken?conditions=state^completed|failed&conditions=endDate>"+date30DaysAgo+"&conditions=endDate<"+currentDate

date30DaysAgo comes from the getDate30DaysAgo() action and currentDate from the getCurrentDateInISOFormat() action, both in the package. In the real URL, the special characters are encoded: ^ becomes %5E, | becomes %7C, > becomes %3E and < becomes %3C.

Note: You can add more states to the query, like waiting or canceled, if you want runs other than completed and failed.

Understand the code

The package has a workflow called Workflow Runs Report Generation, and its code has three parts. To keep it simple, the workflow creates a transient REST host from the inputs you give it. You can also add your Orchestrator as a REST host in the inventory and add the URL above as a REST operation, with the dates as inputs.

Part 2 turns the API response into CSV. Here’s the version I tested on 9.1.1. It uses plain loops instead of for each, and it quotes every value so a workflow name with a comma doesn’t break the file:

// Part 1/3: Invoke the REST operation
// ...

// Part 2/3: Gather data in CSV format
function csvValue(value) {
    var text = (value === undefined || value === null) ? "" : String(value);
    return '"' + text.replace(/"/g, '""') + '"';
}
var reportCSV = "Name,Status,Start Date,End Date,Started by\r\n";
if (response.statusCode != 200) { // 200 - HTTP status OK
    System.warn("Request failed with status code " + response.statusCode);
} else {
    var doc = JSON.parse(response.contentAsString);
    var tokens = doc.link || [];
    System.log("Number of workflow runs found: " + tokens.length);
    for (var i = 0; i < tokens.length; i++) {
        var run = {};
        var attributes = tokens[i].attributes;
        for (var j = 0; j < attributes.length; j++) {
            run[attributes[j].name] = attributes[j].value;
        }
        reportCSV += [csvValue(run.name), csvValue(run.state), csvValue(run.startDate),
            csvValue(run.endDate), csvValue(run.startedBy)].join(",") + "\r\n";
    }
}

// Part 3/3: Send the CSV data as a mail attachment
// ...

The report has five columns, but each run has more attributes you can add, like id, workflowId and metric:totalTime (run time in milliseconds). Part 3 attaches the CSV data as a MIME attachment and sends it to toAddress.

Step by step

  • Import the package from GitHub (Assets > Packages > Import).
  • Open the Workflow Runs Report Generation workflow and click Edit.
  • Open the scriptable task and set these input values:
Input values to edit in the scriptable task: Orchestrator host, credentials and email settings
  • Save the workflow and click Run.
Running the Workflow Runs Report Generation workflow
  • When the run finishes, the logs show the email being sent to the address you gave.
Workflow logs showing the report email being sent

Result

Check your mailbox for the report. If it isn’t in your inbox, check the email address you used and your spam folder.

Email with the workflow runs report attached as a CSV file

Open the attached CSV. It matches what you see in the Workflow Runs tab with the performance view turned off. Sort it on Start Date, newest first, for an easier read.

The CSV report opened in a spreadsheet
The Workflow Runs tab in Orchestrator for comparison

Things to watch out for

  • Don’t use total for the count. On 9.1.1, total comes back as -1 when you page the results with maxResult. Count the items in link instead, like the code above does.
  • Big environments. If you have thousands of runs a month, page the results with maxResult and startIndex, or shorten the date range.
  • Email needs a mail server. Part 3 sends the email through the SMTP settings in the workflow, so make sure Orchestrator can reach your mail server.

Download from GitHub

The package is on GitHub: vRealize-Orchestrator-Reporting—Export-Workflow-Runs-to-CSV-and-Mail.

Download from GitHub

Wrapping up

A small workflow, but it answers the usual questions about workflow runs without opening the UI. Schedule it monthly and the report lands in your inbox on its own. See you in the next post.


Discover more from Cloud Blogger

Subscribe to get the latest posts sent to your email.

Enjoyed this post?

Was this helpful?

2 responses to “Generate vRO Workflow Runs Report in CSV”

  1. Teknik Telekomunikasi Avatar

    Could you explain the process of generating a CSV report for vRO Workflow Runs?

    1. Mayank Goyal Avatar
      Mayank Goyal

      Let’s connect over my LinkedIn https://www.linkedin.com/in/mayankgoyal1994/

Leave a Reply