Camunda : Skip a process instance from a given task to another activity in a "call activity"

Viewed 545

TL;DR : I want to move processInstance from a task in current workflow to an activity that belongs to another call activity in the workflow using businessKey and targetActivityId as inputs.

Consider a workflow diagram as below : enter image description here

My process instance is at user task "UT 1" and I want to modify my process instance to resume from a user task (or any activity/task for that matter) that is defined in "Call Activity 2" completely skipping "Call Activity 1" and any task that is added in between say "UT 1" and "Call Activity 1" without making changes to the workflow diagram. Is there a way to do this given that I have businessKey, the target taskId and camunda java api library?

As per camunda docs, there is this feature for process instance modification.

But this feature would only move processInstance to a target activityId having same processInstanceId, and workflow associated with call activity has a different processInstanceId [but common businessKey]

ie, as per the scenario, my current processInstance is at "UT 1" and the active processInstanceId that I have is of the workflow diagram below. But I need to move to a "Task" in "Call Activity 2" which will have a different processInstance Id.

1 Answers

The problem is that the target (sub) process instance you want to move the token to (for Call Activity 2) has not yet been created. You could move the token before Call Activity 2 and once the process instance referenced by Call Activity 2 has been created you can modify its state. Of course that would only be possible if a wait state has been reached.

Related