Get Current SS_Key Or TimerId when running code from a timer context

Hey guys,

I'm creating a system where I want one timer to wait on another timer (and chain this to some aspect into multiple timers), I know I can use the Cycle entities for most of my needs, but I would like a dynamic way of knowing the current timerId (or SS_Key / something I can match the timer on in the Meta_Cyclic entity).

Currently I can only think of a match between timer name (through a static for instance) and the current espaceId.

Does anybody have an idea on this?

Hi Joey,

Looks like in this document they recommend using the name in meta_cyclic_job. Reading this looks like you don't have other option but use the timer name.

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Joey,

Looks like in this document they recommend using the name in meta_cyclic_job.

Regards,

Marcelo


Yeah I know. But I can't fetch the name dynamically on runtime based on the timer that is currently running the code. 

I would love to have something like, "Hey this is the name I'm currently running this code on" Or "This is my TimerId" (I could check for UserId if the code was being run from a User context, but there is nothing simular for a timer).

Hi Joey,

If each timer run a different action you can hard code the name on that action code. If the same action is run by multiple timers you just need to include a input variable on that action. and hard code the name of the timer on the timer configuration.

Regards,

Marcelo

Hey Marcelo,

Yeah that's exactly what I said, but I am looking for a way to get this way dynamically, without requiring the developer to hard code the timer name on every action the timer touches. I am looking to create a mechanism to restart timers and force them to wait on other timers in a generic way.

It could even become a forge component at that point, but if people are required to hard code the timer names, it still will require effort from the developer.

Marcelo Ferreira wrote:

Hi Joey,

If each timer run a different action you can hard code the name on that action code. If the same action is run by multiple timers you just need to include a input variable on that action. and hard code the name of the timer on the timer configuration.

Regards,

Marcelo


Hehe, I found it Marcelo!

I got it working without required inputs!
I'll post a forge component in a bit.

Nice. When is done let us know about it.

Regards,

Marcelo

Solution

Marcelo Ferreira wrote:

Nice. When is done let us know about it.

Regards,

Marcelo


https://www.outsystems.com/forge/component-overview/5363/timerwait

Here it is!
Don't mind the maintenance screen to setup the timers.... I just scaffolded some entities to create it.

If it gets enough attention I'll reconsider to make it a bit more fancy.

Solution