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
startstate. - It immediately transitions to the
step1state. - The
step1state is of typeparticipantand so it requires user interaction to continue. The workflow will wait in this state until a user who belongs to theapproverswimlane triggers one of the transitions. - If the
approvetransition is triggered, the workflow advances to theapprovestate. Otherwise, if therejecttransition is triggered, the workflow advances to therejectstate. - Both the
approveandrejectstates are of typepassthru. They simple advance the first available transition and go to theendstate. - The
endstate is of typeendand 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 the step1 state.
If the approver swimlane has exactly 1 user, the user will be auto-assigned to step1. On the other hand, if the approver 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.