Parallel - Determine if all branches are approved?

  • 25 February 2008
  • 3 replies
  • 1 view

Badge +9

I am trying to implement a workflow which is basically an approval process for a document.

The process starts, and there are 3 activities which are run in parallel, where each of the 3 users must approve or reject. If ANY of these users reject the process, then the workflow should take the rejected branch, if they have all approved then it should take the approved branch. It should only continue along the approved/rejected branch once all 3 parallel activities have been completed.

Can someone tell me to how determine if all of the 3 people have approved the document? I thought I could approach this by branching into 3 activities (parallel), and then have the outcome of all 3 activities join back into a single activity, and use this activity to determine if the outcome of each of the 3 parallel activities was Approved. However when I try to do this, I can't seem to reference the previous activities' outcomes.

I am pretty sure I am missing something simple here (I am currently trying to evaluate Blackpearl, so am very new to this), but I can't seem to figure this out...

Thanks in advance for any assistance!


3 replies

Badge +4

Hi Arduk,


Please explore K2 Succeeding rule for your scenario.


As such, you don't need to put the task into 3 different activities but one.


Simply apply


(If anyone declined) OR


(all approved)


then the process will move on with the activity complete and outstanding tasks expired.


Hope this helps.

Badge +11

As noted in the previous comments in most situations you don't need three parallel activities to handle this scenario.  Take a look at this whitepaper on advanced destinations and slots.  In most cases, this will be the easiest way to handle parallel approvals.


http://k2underground.com/files/folders/technical_product_documents/entry20948.aspx


That being said, I have occasionally encountered situations where you really do want approvals on parallel paths.  Activity level variables, like outcomes, are only in scope as long as the activity is executing, so you can't reference them in another activity.  An easy way to do this would be to add a process level data field, like a boolean, that will be set for each path.  Set the initial value to false and only set it to true when the approved condition is met.


In the approved path for each parallel route, add a server code event to an activity after the approval, but before the paths join.  In this code event, add a line of code something like this:


K2.ProcessInstance.DataFields["pathA"].Value = True;


In the activity where you want to join up all parallel paths, add a preceeding rule (right-click | Properties | Preceeding Rule).  This rule will only allow the activity to run when it becomes true.  Set the condition of the preceeding rule to make sure all of the variables for each path are true. 


 


 


 

Badge +9

Thanks very much for taking the time to reply to my question - I really appreciate it.

Based on your responses, I will have try to implement it as you suggest - I figured I was missing something simple here.

Thanks DavidL for the link and the method for achieving what I originally asked (even though it may not be required in this case)

Reply