Business Process Flow (BPF) is a very useful tool to standardize data entry on a model driven app. In simple cases, a linear BPF is a good option. However, in more complex scenarios, a BPF can be enhanced by using branching. I will discuss on this blog the limitations and workarounds concerning branching conditions.
I was recently working on a business process flow and I noticed that once I use a condition with multiple rules, I could only use one of either operators: “AND” or “OR”. Moreover, I also noticed that it is not possible to define a branching rule using the type field “Multiselect OptionSet”.
To illustrate these issues I will use the standard “Opportunity Sales Process” by adding a new phase named “Approve” where the user will go through this stage based on a given condition. This means that the user can go through the following two paths:
- We will go through the “Approve” stage if and only if the condition below is true:
(BUDGETAMOUNT >= 100000 OR (50000 <= BUDGETAMOUNT < 100000 AND (RISK = RISK 1 OR RISK = RISK 2))
- Given that “Risks” is a “Multiselect OptionSet”
- This kind of condition is not achievable using the Unified Process Designer.
We will create a technical field (Yes/No) named “Need Approval” which will hold the result of
After creating the Boolean field, we will add it to the BPF. The field must also be present on the previous stage. We will add it and make it read-only with a simple Business Rule.
“Need Approval” field will be calculated by setNeedApproval function:
As you can see, I used the formContext.ui.process.reflow() method. Without the use of this method. The business process flow will not take into account the automatic change of the “Need Approval” field made by the JS code.