Run timers programatically

Run timers programatically

Hello People,

I have functionality of sending e-mails on specific time. 

Suppose I have 10 clients. I want to send them e-mail remider on preset time from the application. If I set time of 10:00 am for two clients, e-mail must be sent at 10:00 am. If I modified timing to 11:12 am and 12:30 pm, e-mails must go on this time.

How to set timers for this?

Please advice.

Suraj Borade
Hi Suraj,

Please look into the following help section:

Important remark:
When setting the timer schedule by assigning to its runtime property, be sure to use the correct time format;

Hope it helps you!
I Suppose the timer works for global function of the site for single event.

Logically does it help for mutliple conditions...[e.g:
Manager X would like to send mails to 10 users every Monday by 9A.M 
Manager Y would like to send mails to 10 Uses every Monday and Tuesday by 9:30A.M
Manager Z would like to send mails to 30 Users every Monday and Thursday by 9:15A.M 

So the sytem has to send mails as per the Users Request... We cannot have a Fixed timeshot predefined inside the system.. One must have the flexibility to select the and day they would wish to send mails

Which object or option would help this type of options
Hi Kayala,
This way, i would suggest to have one timer that runs every 5 min, inside this timer logic, you would check to whom and if it's time to send any of the emails.

Hope it helps you!

Daniel Martins
Alternatively, you can have a table holding the actual schedule (which would typically include the name of the manager, some definition of the users, the time, whether it already run and if so, the result (for retries or the like)), and every time the table is updated, you set the timer to the earliest time. When the timer finishes, it updates its entry with the result, and sets the time to the next run time (or, in case that's in the past, to run immediately).

That works too, Kilian.

A mixed approach ;)

That would save a considerable amount of executions of the timer.