Hello my friend!
As I understand it, you want to terminate all process instances with a timer, even if they have not gone through the entire flow until the end, right?
If so, an easy way to do it is to wrap your entire process in an “extended sub-process” and put a timer as an boundary event.
you can do something like this:
You can do it:
remembering that we have 2 types of timers, interruptive and non-interruptive.
The interrupt is this timer with the double border, the non-interrupt is the one with the dashed border.
The interrupt will make your process instance leave the main flow, and go to the end of the process.
The non-interruptive would not remove the instance from the main flow, basically serving if you want to send some warning to the user that the process is about to expire.
In this example I sent you, you could add another non-interruptible timer, which in 2 days triggers a process sending a message to the user informing that the next day the process will expire.
It is also worth remembering that the timer is triggered at the specified time for EVERY instance of the process…
That is, if an instance entered on the 1st… the timer will activate FOR THIS INSTANCE in 3 days.
If another instance entered on the 2nd… this one will expire 1 day after the first instance… because the timer will activate for each one of them according to the stipulated time.
Just remember that the timer activates per instance… not for the ENTIRE process at once.
You can find more about this in Camunda’s documentation which is very complete.
Hope this helps.
William Robert Alves