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?
Solved! Go 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.
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.
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.
Thanks for accepting the solution and for updating us on your workaround - really useful to other users.
Thanks,
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.