cancel
Showing results for 
Search instead for 
Did you mean: 

Importing process instance from history

prashant_mahesh
Champ in-the-making
Champ in-the-making
Hi,

We are using Activiti 5.17.0 and have a requirement to bring in a finished process instance back into active state. The issue is sometimes user finish off the process and sometime later they realize they have made a mistake and want to put the process back in its last active state.

Just wondering if there is any out of the box functionality which I can use to accomplish this?

I have a possible solution in my mind which will work as follows:
1. Create a new process instance.
2. Copy all the variables from historic process instance into new process instance.
3. Start the new process instance.
4. Delete the historic process instance.

There are few problems with above approach:
1. I will loose the history associated with the old process instance. This is not a good idea as we will loose the information about who did what and when.
2. If I have 5 states in my process (excluding start & end events), the new process instance will be at first state but it should be at the last state.
3. If I don't delete the historic process instance I will ultimately end up with 2 historic tasks which are kind of duplicate.

Any help in this regard is appreciated.

Thanks
Prashant
2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Prashant.

My proposal would be:
  1. Fetch all variables, process instance Id from the history
  2. Create new process instance in runtime tables (You have to create new API method for it, because it is not supported currently.). Start process instance is not good solution because of facts you already mentioned and there could be some automatic steps at the beginning of the process.
  3. Put created process instance on the right activity in the process definition. (There is no API for it currently, but it is easy to implement. The issue could be to create several executions e.g. for parallel gateways.)
  4. Create pull request to activiti core (Could be interesting feature) 🙂
Regards
Martin

prashant_mahesh
Champ in-the-making
Champ in-the-making
Thanks Martin, will try to implement this way.