cancel
Showing results for 
Search instead for 
Did you mean: 

User audit on process variable change

wdefik
Champ in-the-making
Champ in-the-making
Hi everybody. Thanks the activiti developer team for their great job!
My question is: I want to know what user have changed my process's variable. How it can be done?

For example (activiti-engine v5.13):
1) in activiti.cfg.xml - <property name="history" value="full" />

2) Java code

RuntimeService runtimeSvc = activitiRule.getRuntimeService();
TaskService taskSvc = activitiRule.getTaskService();
HistoryService historySvc = activitiRule.getHistoryService();

Map<String, String> vars = new HashMap<String, String>();
vars.put("myVar", "Test");

ProcessInstance processInstance = runtimeSvc.startProcessInstanceByKey("myprocess", vars)

vars.put("myVar", "new value");
taskSvc.complete(taskSvc.createTaskQuery().singleResult().getId(), vars);

Then i can retrieve all variable changes by
historySvc.createHistoricDetailQuery().variableUpdates().processInstanceId(processInstance.getProcessInstanceId()).list()


But an HistoricDetailVariableInstanceUpdateEntity does not have a user id property. Could you tell me any approach how i can get an actor user?
Thanks in advance.



3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
This information is not recorded.
Possibilities:
  1. use task assignee to determine to whom task was assigned. I think it is not what you want to.
  2. extend TaskService.complete method implementation.
  3. put the information (who did the change) into task variables. It will be recorded.

wdefik
Champ in-the-making
Champ in-the-making
Thank you Martin!
I really hope that user info will be recorded in future releases. Because any audit systems should answer to questions: What changes are made? Who did the changes?

martin_grofcik
Confirmed Champ
Confirmed Champ
Activiti currently supports history. It is not auditing.
May be you can
- create ticket in jira.
- (create pull request with implementation) 🙂