Overview
...
const $Xml;
Example
Code Block | ||
---|---|---|
| ||
$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.
Code Block | ||
---|---|---|
| ||
Example Data Model for Pool</p>
<p><form></p>
<p> <Product></p>
<p> <Id>1234</Id></p>
<p> <Orders></p>
<p> <Order></p>
<p> <Id>4567</Id></p>
<p> <Amount>1</Amount></p>
<p> </Order></p>
<p> <Id>8901</Id></p>
<p> <Amount>2</Amount></p>
<p> </Orders></p>
<p> </Product></p>
<p></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
Code Block | ||
---|---|---|
| ||
var productId = $Xml.Evaluate("/∗/Product/Id"); |
Example
Accessing pool root with variable
Code Block | ||
---|---|---|
| ||
var productId = $Xml.Evaluate('$poolRoot/Id'); |