Skip to content

$Xml

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

1
const $Xml;

Remarks

Example

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

Reference point $Xml object points different elements depending of where used. In Pre work, Post work, Role, Route scripts $Xml is bound to process pool element. Rule based Validation and Formatting rules $Xml is bound to control element.

Pool element is created at root of XML tree by default but sub-workflow instances may use any element in 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 product process $Xml will be point to "Product" element.

For Order process (as a sub-workflow of Product process) $Xml will point the "Order" element where is sub workflow is initiated.

For rules on "Amount" field $Xml will point "Amount" element.

Accessing Pool Root Because $Xml may point different elements in data model, in some cases you may need to access pool root element. You can use "/form/Product" xpath or "$poolRoot" variable if you need to access pool root.

Example

1
var productId = $Xml.Evaluate("/&#8727;/Product/Id");

Accessing pool root with variable

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