Tech Bites - Set timers to delete records

< Back to Blog

Hi, and welcome to another Tech Bite.

In this tech bite, we will demonstrate how to set timers to delete records and use an online store as an example.

In the app, we have an entity called Shopping Cart Items, where we save all the items each user is interested in buying.

 

To clear all the shopping carts nightly, we will create a server action Delete All Cart Items. 

Add a SQL node to the server action and write the necessary query to delete all records from that entity. In this case, despite Delete queries not having outputs, every SQL node needs an output structure or entity. Thus we use a dummy output.

 

Next, we’re recording in the system log that the action was completed. Add a Run Server Action to the flow and select the system action Log Message. Add its attributes, Message and Module Name. The recorded message will appear in the OutSystems Service Center logs.

 

Finally, we will create a timer on the processes Tab to run every night. Create a Timer Action Clear Carts that invokes the previously created server Action—Delete All Cart Items— which occurs Daily at 4 in the morning.

 

Now we’re ready to publish. You can check the Service Center logs the morning after to ensure the timer ran as expected.

   

Thanks and see you on our next Tech Bite!

Turn Up Academy

Apply to our Turn Up Boot Camp

AND BECOME THE NEXT OUTSYSTEMS CERTIFIED DEVELOPER
(
Instructor
)

Latest Articles

How to handle timeouts in OutSystems

How to handle timeouts in OutSystems

Join our instructor and OutSystems Champion Cláudia for a step-by-step tutorial on how to troubleshoot timeout issues in the OutSystems platform.

DevZone
How to download Excel files in OutSystems

How to download Excel files in OutSystems

Learn how to download Excel files using the OutSystems platform in this simple tutorial!

DevZone
Mastering Email Integration with OutSystems: A Step-by-Step Guide

Mastering Email Integration with OutSystems

In OutSystems Reactive Web Applications, we can configure the Service Center and implement logic in the Service Studio to send emails to our peers or contacts. Follow this step-by-step guide to learn how to!

DevZone