Going back to previous service task programmatically


I am currently in the making of a Camunda BPMN flow and with the help of the Zeebe java client dependency I am communicating with it programmatically.

I am almost done. However, in the flow there are time when I want to be able to have a “go back” button and when the user clicks it the job instance should go back to the previous service task.

I have read through the documentation but so far I have not found a possible solution on how to do this.

Right now I am using the ActivatedJob object to keep track of the right job and the JobClient object to signal that a task is done.

Any ideas?

If this is a business flow decision, then it should be modeled in the BPMN diagram, rather than trying to code it from the outside.

This could look like an extra variable on the user task form that asks user “Return to prior step?” (Y/N) following that task being marked as complete, evaluate if the “Return to prior step” is “Y”, if so, the flow returns to the pre-defined task. If it’s “N”, then it moves on to the next step in the flow.

It it’s a technology reason to go back, then you should be looking for incidents, and handling them there, and the user doesn’t have any input into if it goes back.