Timer on user task, start only after claiming by candidate

cancel
Showing results for 
Search instead for 
Did you mean: 
davedavedave
Partner

Timer on user task, start only after claiming by candidate

Jump to solution

Im assigning a user task to a candidate group. After a user from the group claims the task, I want to start a timer, and if the user doesn't finish the task in time I want to unassign the user on the task and give it back to the candidate group, so another person can pick it up. What is the best way to achieve this?

 

I tried putting a boundary timer event on the user task, looping it back to the task, but that timer starts at the moment the task is created, so even if its not claimed (yet), it keeps recreating taks every time the timer expires. Is there a way for the timer to start only when a candidate claims the task? Or is there a better way I can approach this? 

1 Solution

Accepted Solutions
afaust
Master

Re: Timer on user task, start only after claiming by candidate

Jump to solution

There is no way to solve this just by modelling. Boundary timers always start on creation - no way around that.

What you could do though (Note: very hacky and probably considered unsupported !!) is to have your boundary timer use an extremely long time to fire (excessively long in fact), and implement a Java-based assignment task listener that "updates" the timer with the proper due date. The fact that "updates" is in quotation marks is due to the fact that APS / Activiti actually does not have an API to simply update the timer. You have to load, delete, and reinsert it after you changed the due date.

View solution in original post

3 Replies
afaust
Master

Re: Timer on user task, start only after claiming by candidate

Jump to solution

There is no way to solve this just by modelling. Boundary timers always start on creation - no way around that.

What you could do though (Note: very hacky and probably considered unsupported !!) is to have your boundary timer use an extremely long time to fire (excessively long in fact), and implement a Java-based assignment task listener that "updates" the timer with the proper due date. The fact that "updates" is in quotation marks is due to the fact that APS / Activiti actually does not have an API to simply update the timer. You have to load, delete, and reinsert it after you changed the due date.

View solution in original post

davedavedave
Partner

Re: Timer on user task, start only after claiming by candidate

Jump to solution

I have implemented it the way you described, indeed it is a bit hacky but it is sufficient for what I want to achieve, thanks! For other people who encounter this problem, i'll give a summary of my solution: I created a task listener as afaust suggested that can be triggered on task assignment. In the task listener I stream over the execution jobs and filter for jobs of jobtype timer. Then with job.setDuedate() I can adjust the timer to my desired value. 

EddieMay
Community Manager
Community Manager

Re: Timer on user task, start only after claiming by candidate

Jump to solution

Hi @davedavedave 

Thanks for accepting the solution and for updating us on your workaround - really useful to other users.

Thanks,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!