Hi All,

I have created timer in my application, and I am assigning the schedule time for the timer at run time. Whenever user updates the schedule time for the particular timer, it overrides the previously updated schedule time of another user who has already set his own. How to differentiate the same timer for different users with different schedule time.Please advice..

Thanks in advance!

Hi Saravana,

Timers usually run for tenant not for specific user. You can schedule the same timer for different tenants but not for specific users belongs to same tenant.

May i know what exactly you want to achieve? or your business requirement?

Regards,

Manish Jawla

Hello Saravanan.

I think you misinterpreted how timers work.

Timers are made for server tasks. They are not user-related.

Every time you edit the schedule, it affects the timer, not the "user timer". That doesn't exist.


What you need is your own entity to say when each user wants the timer.

The timer will run and check among all users who is supposed to run at that moment.

Consider a margin of error because timers don't start at the exact second you want, they may delay 3 seconds or a few minutes. Even better, save a Last Run and check if it it smaller than today's scheduled run. if it is, run.



Nuno Reis wrote:

Hello Saravanan.

I think you misinterpreted how timers work.

Timers are made for server tasks. They are not user-related.

Every time you edit the schedule, it affects the timer, not the "user timer". That doesn't exist.


What you need is your own entity to say when each user wants the timer.

The timer will run and check among all users who is supposed to run at that moment.

Consider a margin of error because timers don't start at the exact second you want, they may delay 3 seconds or a few minutes. Even better, save a Last Run and check if it it smaller than today's scheduled run. if it is, run.



Hi nuno,

I knew that the timers are not user based , it is based on Tenant since the meta cyclic or cyclic job entities don't have any user related constraints. so bringing in custom entity will solve the problem as you say? 

Tenants still run all on the same server.

Use the same logic I said for users, with tenants.

Each time the timers run, it will run for the tenants that want it run.



In addition to Nuno's answer, Timers are, as the Entity name implies cyclic jobs, so the are reoccuring. I don't think you want, or should want, users to schedule reoccuring tasks at will. Also, Timers cannot run more than once at the same time. So depending on what schedule a user sets, the Timer may not run at all! See my article here for more details.

However, if you want users to be able to start a certain Timer just once, you may use BPT with a Wait and a Timeout, starting the Timer with a WakeTimer in an Automatic Activity.