Update executed timer
rusaym opened this issue · 9 comments
Hi!
I have a simple process with timer, user task and script task
By some time, if user didn't signal the user task, timer executes and the script task runs. Script task just notify user that it haven't done its task by the time.
So my question is, if it is any way to update the timer if its already executed, script ran and state updated? For example I want to give user more time to do its job.
Have you tried a repeated duration - R3/PT10M
? The user will be notified every 10 minutes, 3 times.
For example I need a task to be done by June, 3, 10:00, but user haven't done the task on time and I need to reset timer to June 12, 10:00.
So implementation will be something like this?
- I get duration between now and June, 3, 10:00.
- Set Timer = R1/duration
- User haven't done the task on time, script change timer to Timer = R1/100years
- Than some day I realize, that user need time till June, 12, 10:00.
- I get duration between now and June, 12, 10:00.
- Set Timer = R1/duration
and so on...
Like that?
I would suggest more than one non-interuptive timer pointing to the reminder. Or connect an interruptive timer event with a loopback to the user task again, perhaps with an expression that resolves to the required duration.
The repeated non-interruptive timer cannot be updated since it will repeat run with the resolved timeCycle duration.
Thank you for suggestions
Is there any way to update not repeated timer, that is not expired?
Have you inspected environment.timers.executing
? You could attempt to find your specific timer by the owner
property. Not sure if it's the best solution but nevertheless.
And after I got my timer how to set it's new expiration datetime?
Well... not only that. What if the execution is recovered and resumed, then the updated timer is not persisted. Have you had a look at TimerEventDefinition source? With an overload effort you could try to send an api message to the timer that will stop the current and start a new timer.
Could you please provide some example how to do that?