Press "Enter" to skip to content

Learning vRO Part 6 – Actions and OOB workflows

Hey all,

Today I thought we can touch on actions and how to take advantage of of the pre built workflows located in vRO. anyone familiar with coding or vRO knows there is multiple different ways to achieve the same out come, some ways are just more efficient than others.
in vRO depending on what you are using it for we can be efficient in 2 ways we could make the code more efficient or we could use our time more efficiently.

I generally don’t like to re invent the wheel and there are great workflows that come with vRO that will do most day to day administration task for AD or vSphere etc. The issue with allot of these flows is the inputs. For example I want to use the out of the box add AD user to AD group flow, the inputs will be the object AD user and the object AD user group. If executing directly out of vRO these flows are great as it allows us to pick the 2 objects for input and we hit submit.


But what about when we are calling and running workflows externally we want the ability to use strings as we cant pass or select the AD object through the API. ive posted on the use of such scripts for AppD located HERE.

So best thing to do is create a wrapper workflow that contains code to search and find based on a string that we supply and then pass the found object to the existing workflows. Better yet if this is something that could be used in multiple different flows make an action out of it so we can reuse. This saves time as it limiting the amount we have to do from scratch as we are using what has been done already.

Depending on what is trying to be achieved this will save development time re using what we can.

Lets use an example like the above and allow us to add a user to a group with only supplying strings.

As part of every plugin there will generally be methods that come along with it, this will involve a little programming and you could do everything you need from a single block of code but its generally a good idea to break this up into modular components like user search and group search. We can find these methods under tools and select API Explorer.


As we can see from the below image it shows us how to use the method and the syntax.


Lets create an action which will search based on string.

1) Create a blank action, this is done almost identically as a workflow but its located under the actions tab (Cog image) create a folder and add a new action. give it a name and click ok.

2) An action can have multiple inputs but only 1 output. Configure the inputs and their type. as well as select the object type as a return. In this case we want AD User


3) as shown in the above image we need to add our code. This is where we do our search. the inputs we need would be the AD host this is used if you have multiple domains and the user string.
The code used is:

System.log("AD User entered: " + userName);
System.log("Serching for User");
var users ="User", userName,adHost);

if (users.length > 1){

throw "Multiple users found";
System.log("Multiple users found...... exiting");
if (users.length < 1){

throw "No users found";
System.log("No users found.... exiting");
var user = users[0];
return user;

the bit that does the search is"User", userName,adHost) “User” is the type of AD object we are searching for username is our string and adhost is the AD domain we are searching.

4) Do the same as step 3 but this time we are searching for groups. and the return type will be AD:UserGroup the code used as below.

System.log("AD Group entered: " + groupName);
System.log("Serching for Group");
var groups ="UserGroup", groupName,adHost);

if (groups.length > 1){

throw "Multiple groups found";
System.log("Multiple groups found...... exiting");
if (groups.length < 1){

throw "No group found";
System.log("No groups found.... exiting");

var group = groups[0];
return group;

5) Now we need to use these 2 actions and feed the output of them into the out of the box workflow similar to the below image.


6) The inputs to the above flow are a string for the domain, user and group

7) The attributes we are using are the usergroup and user we will output too from the actions. the ADdomains composite types is a list of AD hosts for the different domains. the adhost will be the host we choose from the composite. Composite types were covered in Learning vCO part 4


8) The first script called select domain is where we choose the domain from the composite types (note this is only for AD plugin v2.

9) Add in the usersearch action and setup the inputs and outputs

10) Then add in the action for group search and configure the inputs and outputs

11) now we drag on the “add a user to user group” which is a built in workflow. the inputs for this would be the outputs of the 2 actions.

Time to give it a go.

While this is a simple example it shows how we can use actions and re use workflows provided.
The Flows and actions used here can be downloaded HERE from Flowgrab



  1. Esi
    Esi July 21, 2015

    Hi Scott, thanks so much for your helpful post. It helped me understand the Api explorer part of vco. I have a question regarding computer objects in the api explorer. I would like to create an action that will move computer object from one OU to another but it does not seem that the method exists in the api explorer. do you have any ideas about how to do this without using powershell script. thanks so much for your time.


    • Scott Norris
      Scott Norris July 22, 2015

      Hey Esi,
      No problems, its great to hear it was helpful.
      About the moving AD objects, unfortunately this is one function the AD plugin doesn’t not do. Creation of an object in an OU is fine but cant move one after the fact.

      I will make some calls and see if its something that’s coming.


Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM BOT Question * Time limit is exhausted. Please reload CAPTCHA.