Ad hoc Approval
Let's take a look at an Ad hoc Approval
workflow. The term Ad hoc
is used in the workflow world to refer to a
one-step approval process that can be initiated at any time for straight forward approval.
{
"id": "sample:adhoc",
"title": "Sample Adhoc Approval",
"nodes": {
"start": {
"type": "start",
"transitions": {
"start": "step1"
}
},
"step1": {
"type": "participant",
"title": "Please approve the attached documents",
"description": "The provided documents require your approval",
"swimlane": "approver",
"transitions": {
"approve": "approve",
"reject": "reject"
}
},
"approve": {
"type": "passthru",
"transitions": {
"end": "end"
}
},
"reject": {
"type": "passthru",
"transitions": {
"end": "end"
}
},
"end": {
"type": "end"
}
},
"swimlanes": {
"approver": {
"principals": []
}
}
}
How it works
- The workflow model begins in the
start
state. - It immediately transitions to the
step1
state. - The
step1
state is of typeparticipant
and so it requires user interaction to continue. The workflow will wait
in this state until a user who belongs to theapprover
swimlane triggers one of the transitions. - If the
approve
transition is triggered, the workflow advances to theapprove
state. Otherwise, if thereject
transition is triggered, the workflow advances to thereject
state. - Both the
approve
andreject
states are of typepassthru
. They simple advance the first available transition
and go to theend
state. - The
end
state is of typeend
and so it ends the workflow.
Notes
This workflow intentionally leaves the approver
swimlane empty. The user who launches this workflow will be
prompted to provide one or more principals to occupy the swimlane. The swimlane could be occupied by a single user,
multiple users, a group, many groups or any combination of the aforementioned.
Anyone who is a member of the approver
swimlane will have the option to work on the workflow when it is in thestep1
state.
If the approver
swimlane has exactly 1 user, the user will be auto-assigned to step1
. On the other hand, if theapprover
swimlane has multiple users or groups, the participant state identified by step1
will not be auto-assigned.
Instead, a member of the swimlane will need to first Claim the Task.