Activit 6: Rerun a process from desired step

Showing results for 
Search instead for 
Did you mean: 
Member II

Activit 6: Rerun a process from desired step

Hello Team,

I am using activiti 6 for designing business process for one of our project. The process is pretty straight forward, it consists of number of "User Taks" or "Service Task" with role based assignments. However our Client wants that an admin user should be able to rerun any of the previous "User Task" or "Service Task" at any point of time.

For example, following is my process :

Start –> Service-Task1 –>User-Task2 –>Service-Task3 –>User-Task4 –>Service-Task5 -> User-Task6 -> Service-Task7 -> User-Task8 ->End

Client want that at any point of time during a process execution, an admin user should be able to change workflow execution from : for example state "User-Task8" to any of Service-Task1 or User-Task2 or Service-Task3 or User-Task4 or Service-Task5 or User-Task6 or Service-Task7.

As per Alfresco Community thread : User Task Rollback 

I have created a custom command as 

public class RestartInstanceActivitiCommand implements Command<Void> {
   private final String executionId;
   private final FlowElement flowElement;

   public RestartInstanceActivitiCommand(String executionId, FlowElement flowElement) {
      this.executionId = executionId;
      this.flowElement = flowElement;

   public Void execute(CommandContext commandContext) {
      ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(this.executionId);
      return null;

And executed it with :

BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
FlowElement flowElement = bpmnModel.getFlowElement("Service-Task1");
commandExecutor.execute(new RestartInstanceActivitiCommand(processInstanceId, flowElement));

With this the current task is set Service-Task1, but it is not getting executed automatically as a normal flow would do usually. Also I can see User-Task8 is also active and assigned to the user which I don't want becasue I want to cancel the current task and rerun it from the desired step.

Appreciate your help with a code sample.


1 Reply
Member II

Re: Activit 6: Rerun a process from desired step


Could you please reply if this is possible. If yes, way to do it.