cancel
Showing results for 
Search instead for 
Did you mean: 

enforce a task to another task

weiyi2011
Champ in-the-making
Champ in-the-making
Hi all!

How can I enforce a task to another task by API?
5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
What do you mean by enforcing a task to another task?

weiyi2011
Champ in-the-making
Champ in-the-making
Hi, frederikheremans.

What do you mean by enforcing a task to another task?

Just like my process, when execution's Activity is "Task A" or "Task B" or any other,
I want to take transition to "Task D". What shoud l do? Thanks!

frederikherema1
Star Contributor
Star Contributor
You should complete the task in order to have the flow continue to the next task, in our API this is something like this:

Task task = taskService.createTaskQuery().processInstanceId(procDefId).singleResult();
taskService.completeTask(task.getId());

weiyi2011
Champ in-the-making
Champ in-the-making
You should complete the task in order to have the flow continue to the next task, in our API this is something like this:

Task task = taskService.createTaskQuery().processInstanceId(procDefId).singleResult();
taskService.completeTask(task.getId());


But I want A –> D, or B –> D, or C –> D

There is more than 10 node in My process like "A,B,C",  these node sometimes need jump to "Task D"    Smiley Sad

frederikherema1
Star Contributor
Star Contributor
If that's the case, you should add a conditional gateway before Task B, which has 2 outgoing flows: one to B and another to D (and the same for all your other exceptional cases where you want to skip one or more tasks).

If you really want to be able to dynamically skip any node at any time (without modeling in your process) you shouldn't be using a business-process in the first place Smiley Wink