Hi camunda folks,
I am working on a camunda workflow where i have a scenario,which is a if else condition inside the for loop,so based on the condition i will be setting a variable and based on that variable the flow should be going to an xor gateway and execute a service task provided,But since its in a for loop only after execution of last element, the flow will continue,(ie the last element in the loop will be evaluated and will set a variable and flow will continue to the xor gateway),My requirement is like inside a for loop,i need to set a variable based on that the flow should go to a xor Gateway,evaluate condition and then execute a service task,again return to the for loop back,execute remaining element.
As you can see in the above diagram,my first service task,is where i am writing my for loop logic,so based on the condition ,it should navigate to the below corresponding xor gateways.
My code be like :
mylist.forEach(element → {
if(element.equals(SOME_CONDITION)){
excecution.setVariable(“firstXorGateWay”,true);
} else if(element.equals(SOME_CONDITION)) {
excecution.setVariable(“secondXorGateWay”,true);
}
else {
excecution.setVariable(“thirdXorGateWay”,true);
}
});
So as you can understand,only after executing every elements in the for loop in the first Service task the control will be transferred to the xor gateway,which is not what i need,based on the condition,the flow should be happening.