Versions Compared

Key

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

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.

The following objects are available in the postwork script;

$WorkItem
Current workitem instance.

$Xml
XML data navigator for data model.

Insert excerpt
_InstanceScriptingObjects
_InstanceScriptingObjects
nopaneltrue

Insert excerpt
_GlobalScriptingObjects
_GlobalScriptingObjects
nopaneltrue

Common operations

Updating data model by action

Assigns the completion date to the Data Model if the user selects the "Approve" action.

Code Block
languagejs
titleAssign action
if ( $WorkItem.SelectedAction == 'Approve' ) {
   $Xml.SetValue("ApprovedAt", $WorkItem.End );
}