cancel
Showing results for 
Search instead for 
Did you mean: 

HistoricVariableInstance add execution variables

lewad
Champ in-the-making
Champ in-the-making
First I do following:
List<HistoricVariableInstance> hvi = processEngine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(htask.getProcessInstanceId()).list();

Then check if some variable exist.
If that variable is missing(in my case i try to repaired old tasks execution) in list I want to add it.
Is it possible ?
6 REPLIES 6

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Leward,

I do not see the reason why to change the history.
Could you provide use case?

Regards
Martin

lewad
Champ in-the-making
Champ in-the-making
Thank you for your reply Martin.
I will try to explain my situation.
We have a group with members. Each member processes tasks. We generate and task one and the same thing to all group members (for example if we have a group ADMINS (angel, martin, peter) and  a customer creates a task- we generate 3 tasks). When some of the users approve
one of these tasks he can view it. Other users can't see the task anymore.
They should be view all task in group

For that purpose we created a database view where we follow the status of each task. The calculation is based on some execution variable which is the same for all 3 tasks. For newly created tasks everything is fine but i want to update already finished task executions.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I think I have understood your use case, but I do not see any need to update already finished task execution.

i want to update already finished task executions.

Why?

From my point of view you can add variable to the currently running execution and not to the already finished one.

Regards
Martin

lewad
Champ in-the-making
Champ in-the-making
It was my mistake that this variable  wasn't added when the system was started
As I said in my first comment I am trying to repair the old records in the database.
I have to create a report for a past period in which the execution variable does not exist.
For all old records I can add a variable with value 1.
//21.01.2016
task1 execution1
task2 execution1
task3 execution1
task4 execution2
task5 execution2
task6 execution2
task7 execution3
task8 execution3
task9 execution3
//21.02.2016
task10 execution5 wf_finsihed=1
task11 execution6 wf_finsihed=1
task12 execution7 wf_finsihed=1
task13 execution8 wf_finsihed=0
task14 execution9 wf_finsihed=0
task15 execution10 wf_finsihed=0
task16 execution11 wf_finsihed=1
task17 execution12 wf_finsihed=1
task18 execution13 wf_finsihed=1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I understand now. You can not change the history through activiti API. It is not allowed and it makes sense from my point of view. What you can do is to add variable to the DB manually. You are changing the history which has not be allowed.
The information when the process instance was finished is already in the history tables - may be you can base the reporting on this information instead.

Regards
Martin

lewad
Champ in-the-making
Champ in-the-making
Thank you Martin,
When I followed the instructions in the attached file for migration I resolved my issue but I don't want to do this in production environment.
I was hoping to have a legal way to do that but …. Smiley Happy
For me the issue is finished. Thank you again.