Skip to content

Variables

Custom variables provide a mechanism to define and easily update static values used in scripting (e.g., rule validations, formulas). Variables are accessed using a $ prefix.

Variable Usage

Example in a script:

1
var isValid = $Xml.Sum('ExpenseList/Expense/Amount') > $ExpenseLimit;

This script checks if the sum of expenses exceeds a limit defined by the $ExpenseLimit variable.

Variable Scope and Overriding

Variables can be overridden at the task level, modifying their values within a specific task's scope. For example, a variable set to false at the pool level could be overridden to true for administrative tasks.

Variable Usage in XPath Expressions

Variables can also be used in XPath expressions:

Example in an XPath Expression:

1
var invalidExpenses = $Xml.SelectAll('ExpenseList/Expense[Amount > $ExpenseLimit]');

This XPath expression selects expense items exceeding the $ExpenseLimit.