Workflow Builder Examples
Linear Approval Workflow
The simplest linear workflow with two approvers. Only after the first approver approves, the second approval step is activated. You can add as many approvers to the hierarchy as needed. Use .withUserGroupApprovers(String "GroupName")
if you want to assign a step to a group instead of an individual.
workflow
.addApprovalStep("Sales Manager")
.withApprovers("david.newman")
.setReason("Total Price is over threshold.")
workflow
.addApprovalStep("Regional Manager")
.withApprovers("cindy.smith")
.setReason("Total Price is over threshold.")
Linear Approval Workflow with Parallel Steps
A simple workflow where there are more approvers in the first step and the step is considered approved if at least one of them approves it.
workflow
.addApprovalStep("Sales Manager")
.withApprovers("David Newman", "Abhijit Gupta")
.setReason("Total Price is over threshold.")
workflow
.addApprovalStep("Regional Manager")
.withApprovers("Cindy Smith")
.setReason("Total Price is over threshold.")
If in a parallel step, it is required that a defined number of approvers, or all the approvers must approve the step, use the withMinApprovalsNeeded
method:
workflow
.addApprovalStep("Sales Manager")
.withApprovers("david.newman", "abhijit.gupta")
.withMinApprovalsNeeded(2)
.setReason("Total Price is over threshold.")
workflow
.addApprovalStep("Regional Manager")
.withApprovers("cindy.smith")
.setReason("Total Price is over threshold.")
Linear Approval Workflow with Parallel Steps using User Groups
A parallel step where the approvers are user groups. One user can be a member of multiple groups.
Approve for a Selected Group
A user can be a member of multiple groups for backup reasons. He or she is an approver for group A and is a backup for group B – but typically wants to approve only as a member of group A and not B.
In another usecase, a user who is a member of two groups needs to approve the document separately for each of the groups. It can happen that at a certain point of time the user has all the information needed to approve for group A, but still not enough to make a final decision for group B.
The following code defines a workflow with several parallel group approvers:
When the user opens the Workflow dialog, there is a dedicated section for each group, of which the user is a member. The user can select a group, for which he or she will execute the approval/denial. The section also indicates the status of the approval step and provides a comment field.
Approve for All Groups Simultaneously
There is also an option to approve for all groups at once – approval in one group can execute approval in all remaining groups of which the user is a member.
Note: When the user does not select any particular step in the workflow dialog, clicking the Approve icon will approve for all the parallel groups to which the user belongs. If the user, however, selects a group substep, he or she will approve only for the selected group.
Conditional Approval Workflow
You can dynamically insert an extra approval step to workflow. See Workflow Post Step Logic for details.
In this example, all rebate deals are sent for approval to the Regional Manager but only those over $10,000 must also be approved by the CEO.
The code in the Workflow Logic will be similar to this one:
Found an issue in documentation? Write to us.
Â
Pricefx version 13.1