Releases And Snippets

Run a Task on a Specific Day/Time

Summary

Hey everyone, Louie here from the Xano Customer Success team. In today's tutorial, I'll guide you through automating flows to run on specific days or times within your Xano application, a highly requested feature that optimizes task management without manual interventions.

Getting Started with Scheduled Tasks:

In Xano, tasks or functions can be set to run at predetermined intervals, but today, we're taking it a step further by automating these tasks based on specific conditions, such as the first day of the month or after a trial period ends.

Running a Task on the First Day of Each Month:

To automate a task for the first day of each month, use a precondition utility function in Xano:

  1. Add the Precondition utility to your function stack.
  2. Edit the precondition to evaluate the current day. Use Xano’s timestamp and formatting functions to check if it’s the first day of the month.
  3. Place any actions you want to execute under this precondition.

For instance, this setup ensures your chosen actions only trigger if the current day is the first of the month.

Handling Last Day of the Month and Trial Periods:

Similar principles apply to scheduling tasks for the last day of the month or concluding a trial period:

  • For the last day of the month, adjust the precondition to identify if today's date matches the last date of the current month.
  • To end a trial period, configure your task to run daily. Use a precondition checking if the account creation date plus seven days equals today, marking the end of the trial period accordingly.

Running Tasks at Specific Times:

Sometimes, tasks need to run at a specific time, not just on a particular day. This requires a more granular approach:

  1. Set your task to execute at frequent intervals, like every minute.
  2. Add a precondition to compare the current time with the desired time stored in your database or specified in the task settings.
  3. Ensure the function stack updates records or triggers notifications only when the exact time matches.

This method is ideal for sending notifications or executing time-sensitive actions within your application.

Practical Examples and Use Cases:

In the tutorial, we explore real-world scenarios:

  • Automatically updating user credits or subscriptions at the start of a new month.
  • Concluding user trial periods and updating their account status accordingly.
  • Sending time-specific notifications or updates to users based on their local time or predefined schedules.

Conclusion:

By leveraging Xano's tasks and precondition functions, you can automate a wide range of activities within your application, from subscription updates to user notifications, all tailored to specific days and times. This not only streamlines your backend processes but also enhances the user experience by ensuring timely actions and updates.

If you have any questions or need further assistance, feel free to leave a comment below, subscribe to our YouTube channel for more tutorials, or reach out via our community or support chat.

This transcript was AI generated to allow users to quickly answer technical questions about Xano.

Was this helpful?

I found it helpful

I need more support
Sign up for XanoSign up for Xano

Build without limits on a secure, scalable backend.

Unblock your team's progress and create a backend that will scale for free.

Start building for free