cancel
Showing results for 
Search instead for 
Did you mean: 

Could I restart a process instance from a previously completed task ?

ygu
Champ in-the-making
Champ in-the-making
Hi,

Here is what I would like to do: given a process, I would like to be able to go back to a previously completed task, just as if I was canceling everything that has been done after it, and do it again, just as the first time.

I know this may seem weird, but I do not want the process to include a decision node and a loop to that task since I would like to be able to do it for any task of the process.

As far as I could see, this is not provided in the public API of activiti, am I right ?

So what I decided to do is to execute some custom SQL queries to obtain what I want. I used the following queries :
- insert a new execution for the activity of the task in ACT_RU_EXECUTION
- insert a new task for this task in ACT_RU_TASK
- insert a new task instance for this task in ACT_HI_TASKINST

The result was almost ok: the task is active again, but, once I complete the task again, I would expect the children task to be activated, however, the process just resume from the previous state (the one before I executed the SQL queries).

Can anyone help me on this ? Do not hesitate to tell me if it is not clear.

Thanks a lot
2 REPLIES 2

cjose
Elite Collaborator
Elite Collaborator
Not sure if I understood the requirement correctly. Wondering if the new ad-hoc subprocess/task feature in Activiti 6 will address your requirements? http://bpmn20inaction.blogspot.com.au/2016/02/activiti-6-adds-ad-hoc-sub-process.html

Regards,
Ciju

ygu
Champ in-the-making
Champ in-the-making
Thanks ! But no : )
The following topic is more close to my question: https://forums.activiti.org/content/whats-best-way-design-process-which-allows-user-recall-back-his-...

But I wrote the following code, given valid a executionId and a valid taskDefinitionKey:
<java>
final ExecutionEntity processExecution = Context.getCommandContext().getExecutionEntityManager().findExecutionById(executionId);
processExecution.setActivity(new ActivityImpl(taskDefinitionKey, processExecution.getProcessDefinition()));
</java>

But Context.getCommandContext() returns null.

What are the ways to get the ExecutionEntityManager ? From what object should I start to get it ?

Regards,

ygu