Pricefx Classic UI is no longer supported. It has been replaced by Pricefx Unity UI.

 

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:

def wfStep1 = [
[group: "Sales Mgmt", minApprovals: 1, reason: "Total Price is over threshold."],
[group: "Regional Mgmt", minApprovals: 1, reason: "Total Price is over threshold."],
]

def wfStep2 = [
[group: "Directors", minApprovals: 1, reason: "Total Price is over threshold."]
]

workflow
.addApprovalStep("Approval Step1")
.withUserGroupApprovers(*wfStep1*.group) //the assigned group approvers
.withMinApprovalsForGroups(*wfStep1*.minApprovals) //the count of approvals needed for each group
.withSingleUserMultiApprovalAllowed(true) //enables the users that are members of multiple groups to approve for more than one group
.withReasons(*wfStep1*.reason)

workflow
.addApprovalStep("Approval Step2")
.withUserGroupApprovers(*wfStep2*.group)
.withMinApprovalsForGroups(*wfStep2*.minApprovals)
.withReasons(*wfStep2*.reason)

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.

def wfStep1 = [
[group: "Sales Mgmt", minApprovals: 1, reason: "Total Price is over threshold."],
[group: "Regional Mgmt", minApprovals: 1, reason: "Total Price is over threshold."],
]

def wfStep2 = [
[group: "Directors", minApprovals: 1, reason: "Total Price is over threshold."]
]

workflow
.addApprovalStep("Approval Step1")
.withUserGroupApprovers(*wfStep1*.group) //the assigned group approvers
.withMinApprovalsForGroups(*wfStep1*.minApprovals) //the count of approvals needed for each group
.withParallelStepApprovalAllowed(true) //enables the users that are members of multiple groups to approve for all groups at once
.withSingleUserMultiApprovalAllowed(true) //enables the users that are members of multiple groups to approve for more than one group
.withReasons(*wfStep1*.reason)

workflow
.addApprovalStep("Approval Step2")
.withUserGroupApprovers(*wfStep2*.group)
.withMinApprovalsForGroups(*wfStep2*.minApprovals)
.withReasons(*wfStep2*.reason)

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:

def RebateWF1 = rebateagreement?.lineItems?.any { lineItem ->
	lineItem?.outputs?.find{ it.resultName == "Rebate" }?.result > 10000 
}

workflow.addApprovalStep("Regional Manager").withApprovers("Cindy Smith").setReason("Rebate deal for approval.")
if (RebateWF1) {
	workflow.addApprovalStep("CEO Rebate Approval").withApprovers("Jason Wang").setReason("Total Rebate is over 10,000.")
} 

Found an issue in documentation? Write to us.