Initializing a variable allows you to define some default value for the task output when a user views the task on the Worklist Manager Console. Variables are initialized using the init element of the task definition file. This is not a required section for the file. Variable initialization occurs before the task is created, and once the variable is assigned it cannot be changed. If you define the initialization using the Task Definition Editor Mapper, it automatically writes this section for you.
The format of the init element is as follows:
<init> <variables> ... </variables> <variable-init> <copy> <from>XPath_or_literal</from> <to>XPath_variable</to> </copy> </variable-init> |
For example, this excerpt from the sample project maps the literal value “Approved” to the approveResult:
<variable-init> <copy> <from>'Approved'</from> <to>$TaskOutput.part1/ns:approveResult</to> </copy> </variable-init> |
For an example of how this is implemented in the Mapper, see Initializing Variables Using the Mapper.