APPROVED ANSWER
replied on April 16, 2019
I have two ideas on how you could approach this. One sets up user tasks in parallel, but you'd need to know the maximum amount of approvers beforehand. The other sets up sequential user tasks using a loop, which would be slower but more flexible to adding as many approvers as necessary.
1) Parallel user tasks
Loose guidelines if you know the maximum number of users you support
- Create a user task for each of the potential approvers. If there are a maximum of 10 approvers, you need 10 user tasks.
- If there are only 10 overall approvers and any/all of the 10 may be called on to approve, you can hard code each user task to one of the 10 members. If there are overall more than 10 potential approvers, but you need a random 10 of them, you'll need to use variables. Define variables Approver1, Approver2, Approver3... ApproverN and assign the user tasks to them
- On the initial starting form, you need to set Approver1 through ApproverN either by lookup or the user can set those manually
- You can use a formula to fill a hidden field with Number of Approvers
- After submission, have an inclusive gateway based on Number of Approvers that initiates the correct number of user tasks. If there are 5 approvers, Approver1 through Approver5 should be set and the user tasks 1 through 5 should be initiated.
- This way all 5 approvers can review at the same time and an inclusive gateway can be used to wait for all reviews to be completed
- You can also use signal events and signal boundary events on each user task. If one person rejects the user task, throw a signal to interrupt any active user tasks. That way, Approver3 doesn't need to worry about the task if Approver 1 already rejected it.
2) Sequential user tasks via loop
- On the initial starting form, have the user fill out the form and select the required approvers. Selecting the approvers can be done by the user manually, or by a lookup that returns a multi-value result. For example, let's say the Approver List variable is A, B and C for this instance.
- After the form is submitted, pass Approver List A, B, C to WF and extract the first value A from the list. Use a set business process variable to set a Forms variable named Approver to A, and Approver List to B, C.
- Back in the Forms process, you have a gateway to check if Approver is empty. If it's not, go on to a user task.
- You then have a user task assigned to a user based on the variable Approver (currently set to A). If A rejects the form, go down some rejection path. If A approves the form, loop back to the WF task
- WF will again take in the variable Approver List (currently B,C), extract out B, and set BPs for Approver = B, Approver List = C.
- Approver is not empty so user task will be assigned to B. If B rejects, go down same rejection path. If B Approvers, go back to WF.
- Same thing for C
- Once C approves, WF will set Approver to empty because the list is now empty. The gateway you created in step 3 will see Approver as empty and know the approval task is complete.
This method should work with as many approvers as you wish, but each approver must make a decision before the next one starts.