How To Cancel Activity on Event Gateway

As part of process migration effort, we need to start a process with any user task. To complicate the issue, we further need to start a user task in a subprocess.

To achieve that, we first use createProcessInstanceByKey to start the subprocess, then we use the following to start the user task within the subprocess:

  runtimeService.createProcessInstanceModification(subprocessPid)
    .startBeforeActivity(targetTaskId)
    .setVariables(payload)
    .cancelAllForActivity(sourceTaskDefId)
    .execute();

But the issue is the subprocess starts with an Event Gateway, that we don’t know how to get the activity ID, similar to user task.

Here is the illustrated subprocess model:

How can we get the activity ID of the Event gateway that we can use to cancel the activity on Event Gateway?

Thank you so much for your help in advance!

Jason

Never mind. we resolved the issue.

Can you let us know what exactly you did to resolve the issue?
It’ll be really useful for other people who experience the same problem.

Sure, we are using the following API to get the activity ID of an event gateway, which is a non user task.
runtimeService.getActiveActivityIds(pid)

1 Like