Skip to content

Prework Script

Prework scripts execute before a task is assigned to a user, enabling control over process data or task state.

Common Operations

Auto-Processing a Task

This script automatically processes the current work item without user assignment, advancing the workflow to the next step:

Auto-Process Script:

1
$WorkItem.SelectedAction = 'Approve';

This script sets the $WorkItem.SelectedAction property to 'Approve', effectively completing the task without user intervention. Replace 'Approve' with the appropriate action name for your workflow.

Dynamic Deadline Date

This script dynamically sets the task deadline based on user-entered data:

Dynamic Deadline Script:

1
$WorkItem.DeadlineDate = $Xml.EvaluateDateTime('PaymentDate');

This script sets the $WorkItem.DeadlineDate property to the value of the 'PaymentDate' node in the XML data model.