Capture the Business Group at request time in vRealize Automation

20161114-1A few days ago I had the strange need to capture a requester’s business group in a custom property whilst provisioning resources in vRealize Automation.

Whilst obtaining this information post-provisoning is simple enough, I couldn’t find an obvious way to do this at first. Then I sat down and thought about it.

The requirement was to identify the business group at request time, as this along with some other properties, will be used with various extensibility tools to integrate with things like NSX and Site Recovery Manager.

As we’re running vRealize Automation 7.5 in HobbitCloud, I knew it was possible to leverage custom forms to get this information. However I wanted to avoid using those as I wanted to know how to solve the issue in either 7.2 or 7.3.

Custom forms. Image courtesy of Chip Zoller

The solution

To get what I needed, I created a new module and action in vRO and set the return type to Array/String. I then used the following code:

var bg = new Array();

//Get the tenant and Business Group
var tenant = System.getContext().getParameter("__asd_tenantRef");
var subtenantRef = System.getContext().getParameter("__asd_subtenantRef");

//Get the Cafe details
var host = vCACCAFEHostManager.getDefaultHostForTenant(tenant, true);

//Correlate the ID to a name
var mysubtenant = vCACCAFEEntitiesFinder.getSubtenant(host, subtenantRef);
var name =;

//Return the Business group name
return bg;

I then created a new custom property (hc.businessGroup), with the following details:

Finally I selected my action from those available in vRO.  Once complete I requested a catalog item and my custom property was automatically calculated:

To verify the action works as expected, if you select a different business group from the dropdown at the top, then the form will be redrawn and the action will be called again.

One thought on “Capture the Business Group at request time in vRealize Automation

  1. Pingback: Enabling dynamic site selection in the Private Cloud with vRealize Automation | virtualhobbit

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.