Daily Service to Update Field in Database

Hi there, I have been developing my first bubble app and love it. I am at a point where I need to set up daily processes.

The app connects to an API that schedules podcasts in the future. That functionality works perfectly.

However, I am working on the customer experience, and when it is set to Scheduled, I set status = scheduled, allowing certain elements to show up and change (like text going from Scheduled to Published).

Here are the DB fields:
status = {published, scheduled, draft}
published_date = {published date}

I’m getting lost figuring out the logic to run through the database to check all episodes that are equal to scheduled, and if the published date is equal to today or in the past, we update status=published.

I thought about doing it in real-time when the user logs into their dashboard and checks then, versus a daily service.

Any thoughts or insights would be much appreciated!

You could have a backend Trigger for that data type with a condition thing before change published_date is empty thing now published_date is not empty. Then add the action to schedule an api workflow and make the scheduled date the published_date and there you can make changes to thing status = published. That way you will never have to loop through all things it will just have the events scheduled based on the published_date.

Thanks for the quick thoughts and insight. I appreciate it, and it makes sense.

So, when I initially “Schedule” the podcast, I call the Schedule API endpoint; this allows their platform to schedule it.

With that, I don’t need to call the API on the scheduled date. On that date/time, I want to update the database field from Scheduled to Published.

Do you think it’s the same process?

Yea. When you use the action “Schedule API workflow” you get to select when you want that api workflow to run. So in your case when a podcast is initially scheduled, you can schedule an api workflow for the scheduled date and define that api workflow in the backend to alter the “thing” to have a status = published. This will make it so that when the day of the published_date, the workflow will have already been scheduled and can change the status without any extra planning. Also when you “Schedule an API workflow” you can get that workflow id in the next step with “Result of previous step”. This is important because then you can make a workflow to cancel the scheduled workflow and schedule a new one if the publish_date ever changes.

1 Like

Ok, I’ll check it out. Thanks a lot! :beers:

Thanks for the “Schedule an API workflow” point out. That worked great!