AnsweredAssumed Answered

Checking the resolveTask will activate which task for conditional sequence flows

Question asked by mozcelik on Sep 28, 2016

I am embedding activiti on our AngularJS oriented Web App. We have already implemented our own static task mechanism and I want to entegrate activiti to create dynamic workflow changes on our existing mechanism.

My current problem is simply: current active task is A and it will go to B if ${action.equals("stateB")} and will go to C if ${action.equals("stateC")} otherwise the task A should be still the active task that is it should not be resolved.

I found out that this is not a trivial issue. resolveTask and complete functions of a task directly completes the current task if I want to stay at same user task, I should add an extra flow from exclusive gateway to the task itself. But I have 10 user tasks it is already complicated diagram for user with current flows, I do not want to add an extra backward flow for each task. Also, if I choose to add a backward flow, when no condition is satisfied(for B and C), it resolves the current task (A), then it creates a new instance of the current task (A), and makes it the active execution. I do not want to create another execution of the current task if all conditions are invalid.

I plan to solve this problem by firstly checking if any of the outgoing flow conditions is passed for the provided user variables(action) and current task (A). If that is the case I will resolveTask A, otherwise I will return an exception or a notification to force user to complete necessary steps or inform user for that given action is invalid.  Therefore, I am currently looking a way to find out which user task will be activated next for the multiple sequence flows from the exclusive gateway of the current active user task for the given variables. Is there a way to find which of the flows are valid for the given variables? Or is there any other simple way which I am not currently aware of.