32
Views
6
Comments
How to automatically send emails on the last day of the month
Application Type
Reactive

Hie. I would like to automatically send a statement to the client on the last day of each month. I know how to implement the functionality but i honestly don't know where i should put the process/ code in an app so that its triggered automatically without a user/ admin clicking a button to trigger the process. It should just use system date and if its the last day just send statements on its own. Thank you

Rank: #94

Hello Rudo,

Hope you're doing well.

You should be able to achieve what you pretend using a Timer.


You can schedule it to run according to your needs.

You just need to configure its Schedule property:


Additionally, you can also configure the timer schedule in Service Center.

Please refer to this documentation that may help you to achieve what you pretend:

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Timers

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Timers/Create_and_Run_Timers


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #2517

Hello Rudo, 

Just to add more details to Rui answer, timer action can be your action which receives a date as input parameter. 

Add logic in this action to check if this date is the last day of the month. 

If so, trigger the process to launch the email otherwise leave. 

Set the timer to run daily at a specific time, for instance by the end of the day to 22.00.

Regards, 

Alexandre Yip 

Rank: #70

Hi RUDO,


As mentioned above, Timers are the mechanism in OutSystems to run automated logic adequate to our scenario.

However, you don't have "out-of-the-box" the possibility of scheduling it to the last day of the month.

A possible strategy is to make it run daily and check if it is the last day of the month. If it is, you run your logic, otherwise the timer finishes without doing anything.

Here's how it looks:


The last day of the month is calculated by getting the first day of the next month and subtracting one day like on the screenshot above.

The OML with the code follows in attachment.


Hope it helps.


Regards,
João

ExampleTimerLastDayMonth.oml

Thank you all. I really appreciate you all helped me