Getting started with vCenter Orchestrator Part 2 – Inputs & Attributes

In this post, I’ll show how to use Inputs and Attributes within a workflow.  I was going to make this post more involved, but WordPress doesn’t want to display half of the images that I’ve uploaded and since it’s a getting started series I’ll keep it simple.

Create Attributes

Create a new workflow named “Inputs & Attributes”.

Select “Add parameter’.  When the attribute is first created it has a name of att0 and is of type string.


Click on att0 to change its name.


Rename it to “repeatCount”.


Click on “string” to change the type to number.


Repeat this process and create another attribute with the name of “repeatDelay”.  Give both of the attributes a description.  You should have something similar to.


Create input

Select the Input tab and then select “Add a parameter”.


The input variable will intially be named arg_in_0.  Click on the name to change it.



Leave the type as string and fill in a description.  You should have.


Create scriptable task element

Select the Schema tab, drag a scriptable task element onto the arrow between the Start and Stop elements.


Now we need to bind our input/attribute variables to the scriptable task so that you’ll be able to access the values of the input/attributes in the scripting section of the scriptable task.

Select “Bind to workflow parameter/attribute”.


Select all three entries.


Select the Scripting tab and you will see the input and both attributes listed as inputs (They are listed to the right of “IN”).


Type the following into the Scriptable task input field.

for (var i = 0; i < repeatCount; i++) {
System.sleep(repeatDelay * 1000)


Notice that the input parameters are displayed as pink.

Run workflow

Start your workfow and enter the text you wish to repeat and submit.


Select the Logs tab of the workflow run and you should see the following:


The main takeaway from this post is that workflow elements such as scriptable tasks can access both inputs and attributes that are defined in the workflow.  Inputs are variables that users supply or are passed in from another workflow.  Attributes are variables that aren’t inputted into your workflow but are variables that your workflow can access.  For example, a vCenter/VM name.  When you bind an input/attribute to a workflow element like the scriptable task, it is similar to passing the input/attribute to the workflow element and the workflow element  acts like a function.



Getting started with vCenter Orchestrator Part 1

In this post I’m going to show how to create a basic vCenter Orchestrator (vCO) workflow.  vCO can look intimidating at first, but it only takes learning a few things to get you on your way.  I’m quite new to vCO so if anyone has any helpful suggestions, please leave a comment.  I’ll try to build on this workflow in later posts to provide more complex examples.

Launch the vCO client

Open a web browser and go to your vCO server.  For example, mine is at http://vco5c.vmware.local (no https).  You can choose to either start the vCO client from the webpage or download it to your client.  In this example I’m going to start it from the webpage.  If you haven’t configured vCO yet, there are a lot of blog postings on how to do it or you could see my post here that covers it.


Creating the workflow

I created a folder named ‘Blog’, which you can do by right-clicking on the vCO server and choosing to create a new folder.

Next I’m going to create a new workflow under the Blog folder by right-clicking on Blog and selecting ‘New workflow’.  Make sure to actually right-click on the word Blog and not just anywhere in the area that’s highlighted dark blue or the context menu will not come up.


Give your workflow a name.


After naming your workflow you are dropped into edit mode for the workflow.  There are a lot of options but here are a few highlights.


Selecting Schema will take you to the workflow editor page.


A schema with only the start and end items.


Drag the ‘Scriptable task’ item into the blue line.


You should now see the Scriptable task on your workflow schema.  Give it a descriptive name.


Now we will write one line of code to produce some output, validate the workflow, save and then close.


Run the workflow



In the the next post I’ll show how to use variables within workflows.