Variable Syntax for Emails and Scripts

Using the Variable Assistant

Clicking vars-20x20 in any text field that supports variables opens the Variable Assistant, which shows you the list of variables you can use in the current context, along with a description for each variable.

Basic variable syntax

The basic syntax for using variables in scripts and emails is:

#{variable.subvariable}

For example:

#{request.cpuCount}

Variable values that may contain spaces

If a variable value may contain spaces, enclose the entire variable in double quotation marks. For example, if a VM's name may contain spaces, use:

"#{target.deployedName}"

Custom attribute syntax

When using custom attributes, always enclose the attribute name in single quotes (whether or not the attribute name contains spaces). The attribute name is case sensitive. For example:

#{target.customAttribute['Primary Application']}

Named argument in scripts

When passing a variable to a script that uses named arguments, always enclose both the named argument and the string in double quotes, like this:

"/Computer:This name has spaces".

The following example will not work:

script.vbs /vmname:"#{target.deployedName}"

You must use the following syntax instead:

script.vbs "/vmname:#{target.deployedName}"

Execute Approval Script workflow steps 

Embotics® vCommander® allows you to add both Execute Script and Execute Approval Script steps to workflows. Execute Approval Script steps have a special behavior. If the script output returns exit code 0, the workflow proceeds to the next step; if the script returns exit code 1, the workflow fails, and the request is automatically rejected.

Paths in command line for script steps

When configuring the command line for script steps, you must use an absolute path to the executable, even if the executable exists in the Windows path. Otherwise, Java may attempt to execute the command in an incorrect location.

Formatting the email body

The <a> tag is automatically added to links in emails (only the http protocol is supported). For example, if the value of a custom attribute is a link, the value will be formatted as a link in the email.

If you do not use HTML markup in the email body, the body is assumed to be plain text; <br> and <p> tags are automatically added for new lines.

If you add HTML markup to the email body, however, no additional tags are added.

Date format

Dates returned by variables are of the form yyyy/mm/dd hh:mm:ss.

Permissions

The scripts or executables that are called will run under the vCommander service account. Make sure that this account has the appropriate permissions or the script may fail to run.

See also

Using Variables to Access Embotics® vCommander® Metadata for Workflows provides links to more information on variables.

Workflow Steps Reference provides information on all steps you can add to workflows.