How do I get TaskId of the next user task?

For the following BPMN workflow, i have asynchronous continuous before set for one of my Service Task.
I am trying to get the task id of next user task, which is “Second User Task”, but now lets say due to some reason my Service Call fails, and I cannot complete my First User Task.

i am trying to complete the first User Task using task.complete(taskId), and since my service calls are failing i cannot get the task id of next active user task, how do I get the taskId of next user task in this case.

I know that my token hasn’t reached the next User Task incase of an error in Service Task, but

You can’t. The task does not exist yet and its id is only available when the task is created.

1 Like

In this case, the token should be still at user task, since the service task was not able to complete, right? Since i have the Asyn Continuation set at Service Task

No, you need to uncheck the async checkbox so that the service task following the first user task is executed synchronously and any failure in it causes the whole transaction to roll back and leaves the first user task uncompleted.