Answered

Complex Gateway as converging element

I have question related to Complex Gateway. For instance, I have attached process. If any two department approve the request, process will continuous and third token will be discarded. How I can control the incoming path by using Complex gateway?

Comments (1)

photo
1

Dear Omer,

Based on the details you have provided, we believe you can write an expression (step 4 – Business Rule) on the outgoing flow of the complex gateway to check if the required number of approvals are complete.

In addition to the expression an exclusive gateway is required between Complex gateway and Task 5 to check if the flow should create "Activity 5" (see attached flow). It should create activity 5 only 1 time and not multiple times.

If the required number of approvals are obtained (in this case 2) then the flow will progress to Exclusive Gateway to check if Activity 5 needs to be created. You can add a Boolean attribute to your data model to check this. First time this variable will be true.

When the last activity (the third one out of 2, 3 and 4) then there will be another token going to Complex gateway and in this case also the condition of 2 approvals complete will be true. Then it will flow to exclusive gateway to check if activity 5 needs to be created. On the second pass this exclusive gateway will be false (No path in the diagram below) and the token will wait on the Convergent Parallel gateway to finish activity 5 and finally finish the process.

You can further modify the process model to have Terminate event after "Activity 5" so that all pending tokens are discarded.

Here is a sample expression on the Convergent Complex Gateway for your reference. This is based on our data model that we created for Test purpose. Please modify it accordingly to suit your business needs.

var numberOfApprovals =0;

if(<TestProcess.Task2Approved> == true){

numberOfApprovals = numberOfApprovals + 1;

}

if( <TestProcess.Task3Approved> == true){

numberOfApprovals = numberOfApprovals + 1;

}

if(<TestProcess.Task4Approved> == true){

numberOfApprovals = numberOfApprovals + 1;

}

if(numberOfApprovals >= 2){

if(<TestProcess.createTask5> == false){

<TestProcess.createTask5> = true; // create Activity 5 first time

}else{

<TestProcess.createTask5> = false; // do not create Activity 5 if it was created before

}

true; // return true for complex gateway for 2 or more approvals

}else{

false; // return false for complex gateway for less than 2 approvals

}

Regards