Re-open/Rollback task in process instance

Looking for some possible solutions for below mentioned use cases:

  1. To reopen last completed (system/user) task in flowable existing process instance
  2. To roll back the flowable existing process instance. For e.g From Task 5 to Task 2 along with the compensating process.

Any one has any idea about the same, please suggest !

flowable-admin app allows to move execution to the specified state.

Thanks for the reply Martin !

Could you please specify which API to use for this ? As in admin there is way to migrate process instance which creates new process instance as far as I know. But here we want to make changes in the running process instance only.

Hi SantoshiP,

Could you please specify which API to use for this ?

Have a look on the following test in flowable source:

org.flowable.engine.test.api.runtime.RuntimeServiceTest#testSetCurrentActivityForSubProcessExecution
...
        runtimeService.createChangeActivityStateBuilder()
                .moveExecutionToActivityId(task.getExecutionId(), "taskBefore")
                .changeState();

migrate process instance which creates new process instance

Migration migrates current process instance to the new definition. No new process instance is created. (May be only in some special cases like migration to call activity…)

Regards
Martin

Sure Thanks ! Will check and get back to you in case if any issues.

Thanks
Santoshi

Hi Martin,

The suggested ChangeActivityStateBuilder solution is working fine in case we are reopening any system task flow executes further and works fine, but in case of user task (parallel activity) it reopens only the asked 1 but doesn’t execute the flow and also holds the process at that point no further execution happening.

Please find below the tried scenarios, and please suggest.

Scenario 1:
Process execution starts - user task executed - at 1 of the user task - created reopen request for already completed system task - desired system task got reopen - flow executed further and process ends.

Scenario 2:
Process execution starts - user task executed - at 1 of the user task - created reopen request for already completed user task - desired user task got reopen - no flow executed further and process holds.

Not sure why user task (parallel gateway task) reopening creates this issue. Any help would be appreciated !

Thanks,
Santoshi

May I ask you to prepare a simple jUnit test please?

mvn archetype:generate \
-DarchetypeGroupId=org.flowable \
-DarchetypeArtifactId=flowable-archetype-unittest \
-DarchetypeVersion=<current version> \
-DgroupId=org.myGroup \
-DartifactId=myArtifact