Task Postwork Script

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.

$Instance
Current workflow instance.

$Initiator
Initiator of the workflow instance.

$TestMode
A boolean value that specifies the current workflow instance is in test mode.

$Priority
A value between 0 to 5 specifies the priority of the workflow instance.

$Culture
A string value that specifies the initiated culture of the workflow instance. (Example: "en" or "de" or "tr")

/wiki/spaces/EMK/pages/9930714
Translation dictionary that provides localized texts.

$Database
Provides methods to query relational database.

$Membership
Provides methods to access the organization database.

$Calendar
Provides methods for time based calculations and working hours calendar.

$XmlRepository
Provides methods to query non-relational databases.

$Domain
Allows accessing domain preferences.

$Services
Allows accessing defined web services.

$Messages
Allows sending email messages.

$Crypto
Performs cryptographic and digital signature operations.

$Delegation
Allows accessing user delegation library.

$Files
Allows accessing file repository.

$Documents
Allows accessing document repository. 

Common operations

Updating data model by action

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

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

Copyright © 2010 - 2023 Emakin. All rights reserved.