cancel
Showing results for 
Search instead for 
Did you mean: 

Get idle period for a task

arne
Champ in-the-making
Champ in-the-making
Hi there,

I have been looking for a way to determine the time a task has been idle before it has been claimed by a candidate user?

If I have a process with two sequential <UserTask/> definitions. Both tasks have the potential owner set to a user(xyz). When I now deploy and start the process the start time for the first task is set directly and not when a candidate user claims the task. And that´s what I define to be the "idle time" of a task.

In the project I am working on currently we define the following:

running time = idle time + process time

running time: the total duration
idle time: starting after previous task has completed
process time: time it took a user to complete the task (from "claim" to "complete")

How can I get this figure for tasks? I have not found any way through the API?

I´d be glad if somebody could help!

Thanks in advance,
Arne
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
There is no such thing built in by default in activiti. What you could do, is add a task-listener to your tasks which gets triggered on event "assignement". In this listener, you can set the current time in a task-local variable (delegateTask.setVariableLocal()).

When you task is completed (perhaps in another tasklistener) you have start-time, time that task was claimed and end time. Alternatively, if you wet your history level high enough,  the task-local variables (and task) will be available in the history, so you can fetch the times for completed tasks.

arne
Champ in-the-making
Champ in-the-making
Thanks Frederik,

used the TaskListeners… but from there we have decided to store a 'task history' in a separate table.

Regards,
Arne