Skip to content

$Xml

Provides access to the process data model. $Xml is an instance of the XmlNode object and points to the root of the workflow instance pool.

1
const $Xml;

Remarks

Example

1
2
3
$Xml.SelectAll('//Customer', function(customer) {
  var id = customer.Evaluate('Id');
});

Reference Point The

$Xml

object points to different elements depending on where it is used: - In Pre-Work, Post-Work, Role, and Route scripts,

$Xml

is bound to the process pool element. - In Rule-Based Validation and Formatting rules,

$Xml

is bound to the control element.

Pool Element The pool element is created at the root of the XML tree by default. However, sub-workflow instances may use any element in the data tree.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Example Data Model for Pool:
<form>
  <Product>
    <Id>1234</Id>
    <Orders>
      <Order>
        <Id>4567</Id>
        <Amount>1</Amount>
      </Order>
      <Order>
        <Id>8901</Id>
        <Amount>2</Amount>
      </Order>
    </Orders>
  </Product>
</form>

In the

product

process,

$Xml

points to the

Product

element.

For the

Order

process (as a sub-workflow of the

Product

process),

$Xml

points to the

Order

element where the sub-workflow is initiated.

For rules on the

Amount

field,

$Xml

points to the

Amount

element.

Accessing Pool Root Because

$Xml

may point to different elements in the data model, in some cases you may need to access the pool root element. You can use the

"/form/Product"

XPath or the

$poolRoot

variable to access the pool root.

Using XPath to access the pool root:

1
var productId = $Xml.Evaluate("/∗/Product/Id");

Accessing the pool root with the

$poolRoot

variable:

1
var productId = $Xml.Evaluate('$poolRoot/Id');