Postwork scripts are commonly used to perform tasks after the task is completed. This script may be useful 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 a 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 | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
...
Updating data model by action
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 ); } |
...