Replacement variables and context variables
While working with templates, you might want to refer to
a variable that will not be resolved until the instance has been started
in the runtime environment. This variable is known as a context variable,
because its value is dependent upon the task context in which it is
exists (or the process context for inline tasks). If you want to refer
to such a context variable in a template, you must use a replacement
variable.
Context variables can come from many sources. For example, they
can originate from previous staff resolutions, input/output messages,
custom properties and, in the case of inline tasks, from the surrounding
BPEL process. They can be used in many places:
- staff queries of tasks
- staff queries of escalations
- in the description and documentation of tasks
- in the description and documentation of escalations
- in notification emails sent by escalations.
- durations of tasks
- priority of tasks
- the type property (business category) of tasks
- custom properties of tasks
- durations of escalations
- custom properties of escalations
Use of replacement variables
Context variables might only be available during specific periods of an instance's lifecycle (a task owner is only defined once the task has been claimed) and can resolve either to single or multiple values. Multiple values are returned in a string array (which is represented as a comma separated list when used in an email) .
In cases when you can use a replacement
variable, you will simply be able to click the associated Insert
Variable button and choose something appropriate from
the Replacement Variable Selection window. However,
you can also enter a replacement variable into a template directly
by encapsulating it in
%signs, for example,
%htm:task.originator%.Note:
- Using percent signs within variable names is not allowed.
- If you want to use a percent sign in a string within the replacement
variable, then you will need to use two percent signs (
%%
) instead of one. - Variables can contain XPath expressions. If an XPath expression
contains a
%
sign, it must be escaped as specified by XML (using %).
The categories shown below contain specific details on which expressions can be used and when.
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15