Skip to content

$Xml

Overview

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

Basic Usage

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

$Xml object points different elements depending of where used.

Location Related Elements
Pool Scripts Pool Element
Route Validation Pool Element
Validation Rule Control Element
Formatting Rule Control Element

Pool element is created at root of XML tree by default but sub-workflow instances may use any element in data tree.

For example assume a following data model for a product process.

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.

Accessing pool root with xpath

var productId = $Xml.Evaluate('/*/Product/Id');

Accessing pool root with variable

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