Does flowable process engine have a process rewind functionality?

We are currently modeling a process with a multi-step set of complex input forms that requires to be managed sequentially. The user may however change his mind during the process and come back to a previously already executed step. A rewind functionality that is disabling (not deleting) executed tasks and return in a consistent state will do the job. I didn’t find anything like this in the documentation. Does something like this exists ? Does somebody already imagined a strategy for such problems to solve (canceling the running process and reinitializing a new one at some stage by example) ? Thanks in advance for sharing.

1 Like

Hi,

In the case when you need to move execution from one place to another you can have a look on

Regards
Martin

Hi,

There is some additional prototyping of this kind of feature going on, but I’m not sure when it might be ready for real use. The V6 engine makes this a lot more generic and predictable than the V5 architectures.

Cheers
Paul.

Hi,

I have a similar need to “rewind” processes under certain conditions. Martin Grofcik’s code worked for me in version 5, but I am not clear on how to adapt it to version 6. At the bottom I pasted my Command class for version 5. I gather from the migration guide that I should obtain the ExecutionEntityManager from the CommandContext and get the existing execution using findById. What should I do after that?

Perhaps the following

    execution.setCurrentFlowElement(initialFlowElement);
    processInstanceHelper.startProcessInstance(processInstance, commandContext, variables);

with variables obtained from the execution?

Thanks
Florian

    public class RestartProcessCommand implements Command<Void> {
            private final String executionId;
            private final String activityId;

            public RestartProcessCommand(String executionId, String activityId) {
                    this.executionId = executionId;
                    this.activityId = activityId;
            }

            public Void execute(CommandContext commandContext) {
                    ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(this.executionId);
                    execution.setActivity(new ActivityImpl(this.activityId, execution.getProcessDefinition()));
                    execution.start();
                    return null;
            }           
    }

In the new Flowable V6 there is the ChangeActivityStateBuilder that can be used to move the process to different states. You can get access to it through RuntimeService#createChangeActivityStateBuilder.

For examples have a look at the RuntimeServiceChangeStateTest