Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

Overview

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

const $Xml;

Example

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

Reference point

$Xml object points to different elements depending on where they are used.

In Pre work, Post work, Role, and Route scripts $Xml is bound to process pool element.

Rule based Validation and Formatting rules $Xml is bound to the control element.

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

Example Data Model for Pool

<form>
  <Product>
    <Id>1234</Id>
    <Orders>
      <Order>
        <Id>4567</Id>
        <Amount>1</Amount>
      </Order>
        <Id>8901</Id>
        <Amount>2</Amount>
    </Orders>
  </Product>
</form>

In the product process $Xml will be pointed to "Product" element.

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

For rules on the "Amount" field $Xml will point "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 "/form/Product" xpath or "$poolRoot" variable to access the pool root.

Example

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

Example

Accessing pool root with variable

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

See Also

  • No labels