Using cron job and dates

Hello everyone,

I’m looking to achieve this and I’m wondering what would be the best option to do so:

I have the Users and Tasks thing in the Datas, and I have a cron job that checks the tasks dates every 30 minutes, to change the statuses to “overdue” for example and the date is passed.
The problem is that it uses a LOT of workload Units, and I’m checking this every 30 minutes because I have users from around the world.

So, I implemented the timezones and I though instead of checking all the tasks (possibly 100+ per user), I could just check the users and update their tasks only if the current time for these users depending on their timezone, is midnight.

But I’m struggling to achieve it, could you help with this please? :smiley:

Thank you!

PS: I’m using an external cron job service with the backend workflows to do this every 30 minutes right now.

Why not to use the Schedule workflow on the task due date instead of checking every 30 min? There’s no reason to use an external service for that…
Also, Do you really need that? Sometimes, you can just display it’s overdue in the front end without doing something in DB?

1 Like

Thanks for your answer!

I am using very complex filtering based on many parameters, that’s why I chose to use this strategy, concerning the overdue, available, scheduled etc… :slight_smile:

About the task, after a few tests, it was easier for me like that too. :smiley:

Even if you have complex filtering, I guess that if you care actually about WU consumption, you should try to do it in bubble and just Schedule an API Workflow on the due date of the task with the filter you need and compare VS the actual solution you have…

1 Like

Thank you! I’ll try your solution to save some WU! :slight_smile:

1 Like

I don’t know much about your filters too, but often, there’s solution to reduce their complexity…

I have a filtering system allowing to show tasks based on a few things for eample:

  • assignees
  • tags
  • start date and/or due date
  • priorities…

And the taskss are categorized.

At midnight, the system checks if there are tasks that are planned for today, then it changes their status from “scheduled” to “available”, same for overdue…

Since I want to change the status at Midnight, but based on the user timezone, I implemented the timezone in the app, then I want to modify tasks at midnight only if it’s really midnight for the user haha

Your case sound more like a “display case” than a WF case. Because you are using timezone and you will show a different “status” according to this (personally, I would not have made the choice and I would have opted for a specific timezone for the change of status but this is just a different point of view, not a bad choice :wink: ) Because it’s a display case, I would choose to have a checkbox for “Completed”. The status would be set in frontend instead and based on conditionnal. New, Available when date = today, Overdue when date < today, Completed if checkbox = true. No need to run a backend WF, cron job or anything else. Other filter will work fine with your RG/table filter.

However, if you want to continue that route, you can schedule API WF also based on specific/dynamic timezone. Just use the correct parameters for that in Schedule API WF action or in Backend WF (be careful that it may be hard to find the right setting at first, but this is possible. Pretty sure there’s a topic about that on the forum or manual)

1 Like

It’s really helpful! Thank you! I’ll try to implement this and see how it works. :smiley:

I’ve analyzed your answer, and the filtering is actually already based on frontend.

For example and with context: There is a list of tasks and the filtering system is on the left.
When someone checks a specific status (available, scheduled…), it adds the status (which is an options set) in a state. The RG displays the list based on what is in the different states.
There are different states (tags, statuses, assignees, start and due date, priorities…) linked to different checkboxes in the filtering sidebar.

Here are some screenshots.



Both can be done using the date field. Display status and filter task based on the due date. Some advanved or filtered stuff could be removed. A little bit hard to tell without knowing what filters are.

This topic was automatically closed after 70 days. New replies are no longer allowed.