Postwork script scripts are commonly used to perform tasks after the task is completed. This script may be useful like for updating databases or generating documents by the user entered data.
Because the task is already completed, some operations (for example; , trying to set an action on current workitema current work item) are invalid at this stage, and an error is thrown.
Postwork script defined area is reached from a related task. When you click on the "Postwork script" button on the task, the postwork script page will open.
Example:
In postwork script The following objects are available :in the postwork script;
$WorkItem
Current workitem instance.
$Xml
Xml XML data navigator for data model.
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Common operations
Updating data model by action
Assign Assigns the completion date to the Data Model if the user selects the "Approve" action.
Code Block | ||||
---|---|---|---|---|
| ||||
if ( $WorkItem.SelectedAction == 'Approve' ) { $Xml.SetValue("ApprovedAt", $WorkItem.End ); } |
...