Using Scripts in Workflows

Information about using scripting with Policy Manager workflows.

Workflow Management Workflow Library

Table of Contents

  1. Introduction
  2. Built-In Script Variables


Scripting can be used to provide customer-specific processing for workflow <condition> and <function> elements of service and contract workflow. Scripts can be embedded in the workflow XML definition or they can be referenced from the workflow to a file system location. Workflow scripting currently supports BeanShell and Jython scripts for PM61 and JavaScript for PM7x.

The following Workflow function can be used to invoke a script to perform any special processing that is required. This same structure is used to invoke a script in a <condition> workflow element. In this case, the script must return a boolean value.

invoking a script

Supported Arguments
<arg name="lang"> beanshell | jython </arg>
Specify one of these values to select the language of the script. BeanShell ( or Jython ( are supported for PM61 and JavaScript for PM7x (
<arg name="file">script-file-path</arg>
<arg name="script"> body of the script </arg>
The script to be executed can be either read from a file or included directly within the workflow definition XML file. Use one of these two arguments to specify the script body or its file system location accessible to the Policy Manager containers.
<arg name="var-name">var-value</arg>
You can specify any number of additional arguments that will be passed into the script as native script variables.

Built-In Script Variables

The following native script variables related to the workflow context are assigned before the script begins execution.

The Subject for the current caller of the workflow action. This contains the actual Java Subject object while the ${caller} workflow variable will only contain the user
name of the current caller.
A set of name/value pairs that can be referenced as workflow variables. This is a Map<String,Object> Java object. The information contained in this variable only exists for the current action execution (and any triggered automatic actions.)
This is a collection of named data elements that can be accessed as workflow variables. The information contained in this variable is persisted throughout the lifetime of the workflow instance. This is an Open Symphony PropertySet Java object.
The unique key of the service. (Defined for service workflows only.)
The unique key of the contract. (Defined for contract workflows only.)
Any additional <arg> elements present in the scripted function or condition definition will be assigned to script variables. For instance, if the script definition contains the element below, a script variable named myPhone will be defined and assigned the script value of 555-1212:
<arg name="myPhone">555-1212</arg>

back to top