Generate vRO Workflow Runs Report in CSV

Run this Workflow and Generate a CSV report similar to Workflow Run tab in vRO and send it over the email.

Generate vRO Workflow Runs Report in CSV

TL;DR Download the package from here & edit the inputs and run it to get a CSV Report for last 30 days of Workflow Runs in vRealize Orchestrator.

Many times, we have environments where we want to monitor the executions of vRealize Orchestrator Workflows, like how many times a workflow is run, who executed the workflow, or what was the success rate of a particular workflow, or maybe just want to check how long it takes to execute a workflow. I have seen a few customers that were looking for similar solutions. So, If you are also looking for a way to achieve something similar, this article could be of some help.

As we know, vRO offers REST API out-of-the-box for all kinds of operations. The same is true for getting the facts and figures of its workflow execution. There are various ways to get that kind of information but I find using the catalog-service-controller module to be the quickest for my use-case. Let’s see it in detail below.

Understand the REST API

The catalog-service-controller module is quite a versatile API module in vRO. You can use it to dig-in information for an extensive set of entities. However, the path and method we are mostly interested in today is, GET /api/catalog/{namespace}/{type}.

Namespace = System
type = WorkflowToken

where date30DaysAgo will get its value from getDate30DaysAgo() action and currentDate from getCurrentDateInISOFormat() action available in the vro-package.

Note You can add more states to this query like waiting, canceled, etc. if you are interested in workflow tokens other than completed and failed.

Understand the Code

In the package attached, we have a workflow Workflow Runs Report Generation which will have the code divided in 3 parts. For ease of operation, the workflow is creating a transient REST host using user provided inputs but you can also add your vRO as a REST Host in the inventory and add this REST URL as a REST Operation with dates as variable input. Also, in Part 2/3, only 5 properties are added to the CSV data. You can lookup for additional properties related to a workflow token if you want a more details-heavy report.

//Part 1/3: Invoke Rest Operation

//Part 2/3: Gather data in CSV format
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);
    System.log("Number of failed or cancelled tokens: " +;
    for each(var link in {
        for each(var attribute in link.attributes) {
            if ( == "name")
                var wfName = attribute.value;
            if ( == "state")
                var wfState = attribute.value;
            if ( == "startDate")
                var wfStartDate = attribute.value;
            if ( == "endDate")
                var wfEndDate = attribute.value;
            if ( == "startedBy")
                var wfStartedBy = attribute.value;
        reportCSV += (wfName + "," + wfState + "," + wfStartDate + "," + wfEndDate + "," + wfStartedBy+"\r\n");

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

In Part 3/3, we are simply attaching the CSV data as a MIME attachment and sending it to the toAddress.

Let’s Run it

  • Import the package available here. If you need help with package import, follow this guide here.
  • Go to workflow Workflow Runs Report Generation and Click Edit
  • Go to the scriptable task and edit these input values.
  • After editing the values, Save it.
  • Click Run.
  • If the workflow is executed successfully, you will see in the logs, the mail is being sent to the provided email address.
  • Check your mailbox. If you can’t see the email in your inbox, probably check the email address that you’ve provided or check your SPAM folder.
  • Download the attached CSV file and Open it. You will see a sheet which will be identical to what you have in your vRO Workflow Runs Tab (Performance view OFF). You may also want to sort this sheet on Start Date column in descending manner.

Download vRO Package

That’s it in today’s post. I hope you will like it.

Leave a Reply

Related Posts

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