Postwork Script
Postwork script are commonly used perform tasks after task is completed. This script may be useful like updating databases or generating documents by user entered data.
Because task is already completed some operations (example; trying to set action on current workitem) are invalid at this stage and error is thrown.
Postwork script defined area is reached from related task. When you click on Postwork script
button on the task, postwork script page will open.
Example:
In postwork script following objects are available:
$WorkItem
Current workitem instance.
$Xml
Xml data navigator for data model.
$Instance
Current workflow instance.
$Initiator
Initiator of workflow instance.
$TestMode A boolean value that specifies the current workflow instance is in test mode.
$Priority A number value between 0 to 5 that specifies the priority of workflow instance.
$Culture
A string value that specifies the initiated culture of workflow instance. (Example: en
or de
or tr
)
$Localization
Translation dictionary that provides localized texts.
$Database
Provides methods to query relational database.
$Membership
Provides methods to access organization database.
$Calendar
Provides methods for time based calculations and working hours calendar.
$XmlRepository
Provides methods to query non-relational database.
$Domain Allows to access domain preferences.
$Services Allows to access defined web services.
$Messages
Allows to send email messages.
$Crypto Performs cryptographic and digital signature operations.
$Delegation
Allows to access user delegation library.
$Files
Allows to access file repository.
$Documents
Allows to access document repository.
Common operations¶
Updating data model by action
Assign completion date to Data Model if user selects Approve
action.
//Assign action if ( $WorkItem.SelectedAction == 'Approve' ) { $Xml.SetValue("ApprovedAt", $WorkItem.End ); }