Some VMware Aria Automation operations require you to create a wrapper workflow in Automation Orchestrator.

You can design a wrapper workflow from scratch or duplicate the sample Event Broker template workflow included in the sample package and modify it as required.

We call it the "wrapper" workflow because it is often a workflow that connects VMware Aria Automation to Automation Orchestrator workflows. For example, extracting data from the payload, finding a VM object in the Automation Orchestrator inventory by ID, and starting another workflow by taking the action on this VM.

The first requirement for creating a wrapper workflow is that it must have the single payload input of the Properties type named inputProperties. This is different from vRealize Automation 7.x where the input can be named anything as long as it was of the Properties type.

In this wrapper workflow, you might need to retrieve specific information from the inputProperties input or system context metadata. Similarly to vRealize Automation 7.x, this is done with the inputProperties.get(parameterName); and System.getContext().getParameter("metadataName"); methods, except the parameter and metadata names are changed and can be identified in the Event Topic and Workflow Run tabs in Automation Assembler.

A good practice for wrapper workflows is to have a first "Get payload and execution context" element, as either a scriptable task or action element, that retrieves the required information. You can bind these elements as a output to the workflow variables and use them as input parameters in subsequent elements, such as scriptable tasks, actions, and workflows.

Retrieving the individual properties from from the Properties type InputProperties is done through the GET method.

The returned properties value can be of the type string, number, boolean, or an array of any of these or complex properties which maps to the Properties type in Automation Orchestrator.

Many of these properties are object IDs that need further processing to retrieve useful information.

For example, retrieving some information from the catalog is done as follows (code snippet from the Create an Event Broker subscription workflow sample):

var catalogItemId = inputProperties.get("catalogItemId");
if (catalogItemId != null && catalogItemId !="") {
    var catalogItemObject = getObjectFromUrl("/catalog/api/items/" + catalogItemId);
    if (catalogItemObject != null) {
        System.debug(getPropertiesText(object2Properties(catalogItemObject), "Catalog Item\n", 1));
        System.log("CatalogItem ID : " + catalogItemObject.id);
        System.log("CatalogItem name : " + catalogItemObject.name);
        System.log("CatalogItem description : " + catalogItemObject.description);
        System.log("CatalogItem type name : " + catalogItemObject.type.name);
        System.log("CatalogItem created By : " + catalogItemObject.createdBy);      
    }
}

This example can be used to retrieve a vCenter VM (code snippet from the Create an Event Broker subscription workflow sample):

try {
    if (inputProperties.get("componentTypeId") == "Cloud.vSphere.Machine") {
        var vcUUID = inputProperties.get("customProperties").get("vcUuid")
        var vmUUIDs = inputProperties.get("externalIds");
        for each(var vmUUID in vmUUIDs) {
            vCenterVM = System.getModule("com.vmware.vra.extensibility").getVCenterVMByUUID(vcUUID, vmUUID);
            if (vCenterVM != null) {
                System.log("Got vCenter VM " + vCenterVM.name + " with ID " + vCenterVM.id);
            }
        }
    }
} catch (e) {
    System.warn(e);
}

This example can be used to retrieve metadata properties below (code snippet from the Create an Event Broker subscription workflow sample):

// The execution context is where the vRA extensibility metadatas are passed
var executionContext = System.getContext();
 
 
// Getting specific execution context parameters
var eventTopicId = executionContext.getParameter("__metadata_eventTopicId");
var eventId = executionContext.getParameter("__metadata_id");
var isEventBlocking = executionContext.getParameter("__metadata_hdr_blocking");
var orgId = executionContext.getParameter("__metadata_orgId");

Read and write parameters can be configured by creating workflow outputs matching their name and types.

Another important element of working with wrapper workflows is using tags. The following example shows you how you can add a tag:

// Adding TAG
tags = inputProperties.get("tags");
if (tags == null) tags = new Properties();
tags.put("serviceLevel", "Gold");

The payload and metadata parameters values and the output values set by your workflow can be monitored by navigating to Extensibility > Activity > Workflow Runs.

The sample workflows include a Create an Event Broker subscription workflow, which can be used to automate the creation of subscriptions, and a Create sample "Event Broker Template" subscriptions workflow, that creates a subscription for each event topic starting the Event Broker Template workflow. This workflow provides the following capabilities:

  • Displaying the content of the payload.

  • Displaying the content of metadata.

  • Provides an example on reaching back to VMware Aria Automation to retrieve the properties of the objects provided as IDs in the payload.

  • Provide an example on converting payload IDs to Automation Orchestrator objects to bind the operation workflow on the object. You can use this to convert to VC:VirtualMachine to create a snapshot.

  • Display the parameters that support being changed with workflow outputs.

  • Update custom properties.

  • Update tags.

  • Update VM names.

  • Get host selections.

    There is a different Event Broker template workflow under the inventory objects folder that retrieves the plug-in inventory objects available from the payload. This allows you to set workflow variables to objects such as projects to bind them as input parameters of other workflows.