Skip to content

WorkItem

Represents a step of a workflow instance, such as a task assigned to a user.

Remarks

The work item of the current script is $WorkItem. Other work items are reached through WorkItem.Previous, WorkItem.NextItems, Instance.InitiatorWorkItem and $Domain.GetWorkItem.

WorkItem.State shows where the work item is in its life cycle, from Created and Waiting to Completed. In a prework script, properties such as WorkItem.Caption and WorkItem.DeadlineDate change how the task is shown to its owners. The data of another work item can be read through WorkItem.Data, but changes to it are not saved.

Examples

Read the decision of the previous step

1
2
3
4
5
var previous = $WorkItem.Previous;

if (previous && previous.SelectedAction === 'Reject') {
    $WorkItem.Caption = 'Revise request ' + $Xml.Evaluate('Id');
}

Capabilities

Metadata

Properties

Context

Lifecycle

Actions

Retrieval and Ownership