Hello community,
I need to get variables of completed tasks by assignee and processKey.
What I’ve done so far, I can get completed tasks by assignee and processKey using this code, but is there any idea to get variables.
You have fetched historic tasks for completed instances from above query. Now next step would be collecting list of taskIds from the result set. Once taskids are collected then query for variables.
Create one container class which will have associated task and its variables.
Thank you very much @aravindhrs for your reply,
Actually it did work like a charm, but regarding your code, all the tasks gives me :
variables : null
And this is quite joking because before posting my issue, I’ve tried to use this code to get the list of all completed tasks by assignee/processKey as you said.
And it gives an empty array , which obviously correct because your code too it gives no variables !!
These variables that I’m trying to get, are setted for tasks, so my question is now :
Can I get these variables even their tasks are completed ?
Just check the scope of the variable, whether it stored as task variables or process variables.
I checked the table ACT_HI_VARINST, and it gives task_ID_ : null for all my variables, but for process keys, they are defined, like PROC_INST_ID, PROC_DEF_ID, PROC_DEF_KEY… So in this case, if I understand, these variables are stored as process variables ? even I set variables using TaskService. taskService.setVariables(taskId, variables)
Also check whether the tasks filtered by assignee has variables or not.