Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

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

Reference point

$Xml object points to different elements depending of 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

Code Block
languagexml

...

<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 point 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 if you need to access the pool root.

Example

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

...

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

See Also