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.

2014-03-25_21-51-17

Click on att0 to change its name.

2014-03-25_21-51-27

Rename it to “repeatCount”.

2014-03-25_21-49-15

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

2014-03-25_21-49-26

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.

2014-03-25_21-51-01

Create input

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

2014-03-25_21-51-17

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

2014-03-25_21-51-27

2014-03-25_21-51-51

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

2014-03-25_21-55-12

Create scriptable task element

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

2014-03-25_21-52-50

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”.

2014-03-25_21-53-03

Select all three entries.

2014-03-25_21-53-35

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

2014-03-25_21-53-48

Type the following into the Scriptable task input field.

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

2014-03-25_21-54-26

Notice that the input parameters are displayed as pink.

Run workflow

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

2014-03-25_21-55-45

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

2014-03-25_21-56-15

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.

 

 

Advertisements

One Comment on “Getting started with vCenter Orchestrator Part 2 – Inputs & Attributes”

  1. dfillmore says:

    Thanks, this helped me 🙂


Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s