# Accessing timer value set after it is activated

**URL:** <https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524>\
**Category:** Flowable Engine\
**Created:** [October 11, 2021, 7:34am UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524 "2021-10-11T07:34:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anki](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Anki](https://forum.flowable.org/u/Anki)\
**Post date:** [October 11, 2021, 7:34am UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524/1 "2021-10-11T07:34:52Z")

</div>

Hello Team,  
So we have a scenario where we have a timer boundary event(with custom duration value for eg., ${timerValue}) attached to a user task. We need to send notification to an audit service with the value of time for which the task is going to be active before the timer boundary event expires and the flow moves in non-default path. We are sending this notification via Task Listener at create event. The problem is, we cannot query the Job table to get the exact time set at the create event of Task because the timer isn’t activated by then. Is there a way to integrate Java code between the creation of task and activation of timer? I know it’s a bit confusing but please let me know if you need me to elaborate more here.  
Thanks  
Ankita

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [October 11, 2021, 10:10am UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524/2 "2021-10-11T10:10:09Z")

</div>

Hi Ankita,

From my point of view, **the easiest way** is to trigger an expression like ${sendNotificationToAuditService(timerValue)} on `CreateEvent`. Send the timer value directly from the expression evaluation.  
Another possibility is to evaluate expression in the listener.  
**To get timer expression:** get Execution, get activityId, get definition and activity from the definition, get expression from the timer. (Or just simple → put the expression directly into listener.  
Evaluate expression and send the value to audit service.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![Anki](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Anki](https://forum.flowable.org/u/Anki)\
**Post date:** [October 11, 2021, 10:35am UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524/3 "2021-10-11T10:35:03Z")

</div>

Hi Martin,

Thanks for replying so soon. There is another catch to the problem, we have a custom calendar. So, the timer value gets evaluated another time when timer is activated. We are currently doing what you have mentioned but we need the evaluated date/duration.

Thanks,  
Ankita

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [October 11, 2021, 11:44am UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524/4 "2021-10-11T11:44:56Z")

</div>

Another possibilities:

1. Listen to [TIMER\_SCHEDULED](https://flowable.com/open-source/docs/bpmn/ch03-Configuration/#supported-event-types) event. In that case you will get timer object. `eventDispatcher` can affect performance. But I would say, it is the cleanest possibility.
2. [hook into process parsing](https://flowable.com/open-source/docs/bpmn/ch18-Advanced/#hooking-into-process-parsing) and change behavior of the boundary timer event to send the notification.
3. Wait till transaction is committed and check the timer in the DB - I do not prefer this one.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![Anki](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Anki](https://forum.flowable.org/u/Anki)\
**Post date:** [October 11, 2021, 1:46pm UTC](https://forum.flowable.org/t/accessing-timer-value-set-after-it-is-activated/8524/5 "2021-10-11T13:46:17Z")

</div>

Hi @martin.grofcik ,

Thank you so much for listing down all of these. I’ll try all of them and will update here. Thanks a lot!

Thanks  
Ankita
