Prework script are commonly used to control process data or task state before assign to the users.
In prework script following objects are available;
$Xml
Xml data navigator for data model
$WorkItem
Current workitem instance.
$Instance
Current workflow instance.
Common operations
Auto Process Task
Automatically process current work item without assign to users and skip to next step in workflow.
Assign action
$WorkItem.SelectedAction = 'Approve';
Dynamic Deadline Date
Set deadline date by user entered data.
Assign action
$WorkItem.DeadlineDate = $Xml.Evaluate('PaymentDate');