How to delete from database all things early current date?

Hi. I have a things in database with dates in fields type Date. I want when this dates not actuality anymore it automatically to delete. I have a button and need to click it all things with date early current date. How I need to set workflows? Thanks

I think for any repeating/automatic task backend workflow is the solution. Hope who are experienced in this will come up with a silution

Hey there!

@kazimdgoni has the right of it, you’ll need to set up a recurring backend workflow to manage this task for you. Probably set to run once per day.

However, Bubble’s own “Recurring Workflow” has a rather unfortunate limitation for users not on the higher tier plans (Professional+) in the fact that they can’t set recurring workflows to be run very often. Professional or higher is needed for Weekly runs and Production or higher is needed for Daily.

Hope is not lost, however, as you can “cheat” the system and make your own. What you’ll need to do is set up a backend API workflow, we’ll trigger this for the first time with a button and from that point onwards it will automatically schedule itself each day

The first step, if you don’t already have Backend Workflows enabled would be to turn them on. This is easily done through the API tab of your apps settings

Once this is taken care of, “Backend Workflows” will appear at the very bottom of the page list in the top left of your screen.

Now that we’ve got backend workflows up and running, the next step is to create the workflow. This will handle deleting the items that are past their date and then schedule itself again.

You’ll want to create a new API workflow and name it appropriately. In this case, I’ve gone with “daily_trigger”.

Inside this workflow, we’ll want to add two actions. One to delete the list of items and the other to schedule itself.

Deleting the list of items is easy enough, you just need to use the Bubble function “Delete a list of items” and set it up to do a search for all items where “Date < Current Date/Time”. As I don’t know what your database item is called, I’m using a mock one called “Event”

The second action we’ll want to set up is “scheduling” itself for the next day. This step uses the “schedule API workflow” action, selecting “daily_trigger” as the chosen workflow. We’ll then tell it to take the “Current Date/Time”, add one day to it (to make it tomorrow) and then set the hours, minutes and seconds to 0.

The reason for doing this is because Bubble will schedule this after deleting the list of items. Setting all the time fields to 0 gets Bubble to schedule this for exactly midnight, whereas if we just do +(days):1, it would slowly end up later and later.

Imagine it takes 1 minute to delete the list every time, if we didn’t “reset” the timer to midnight, it would run at 00:01, then 00:02 and after several months it’d be over an hour in the future.

You can naturally change this “set time to 0” to any time of the day you like, though.

Once this is done, all we’ll need to do it copy this “schedule” action and paste it onto any button you have.

You only need to click this button one time, and it will get this workflow going permanently. You can freely make changes to these workflows and any updates will apply the next time it runs.

Please note that if you’ve got a Development and a Live version of your Bubble app, you’ll need to click it once on each environment, as you cannot schedule Live version items from Development and vice versa.

I hope this helps! Please let me know if you have any questions or queries

Kind Regards,
Joseph @


Thank you so mush for your detailed instructions. But I have a things in database not as list of things. Can I set the same workflow in this case?

@bluesun440 That’s the benefit of this method, it goes through your database and will delete all items in the list of things that meet the criteria.

I see you’ve named your database item “Times”. You’ll want to set up the “list to delete” field as “Do a search for…” and select “Times”.

Then, inside the search, you’ll want to set it up to only delete items where ‘date < current date/time.’

This entire system is designed to be automatic. You’ll trigger the button once and then never need to do so again, every day at midnight it will delete all “Times” that are now in the past.

Kind Regards,
Joseph @


Hello @bluesun440 ,

First, you have to create a workflow on page load and create an event for deleting the data from the database.
Set a condition for the event if the data date is < current date/time then data will be deleted. If it is greater than the current date/time then the event will not run.

If any further assistance is required get in touch with me on:


wow! it’s works, thank you!

thank you!

I have another one question: this flow is working, clear all dates early current date, but including current date. How I can to delete all exept today?

@Joseph-Harris Wow. That was great. I also learned a lot. I was always confused about recurring and scheduling workflow in the backend. It helped me a lot too.

There are very few details about backend workflow and very few of those are clearly saying anything that might help the beginners like me.

Thank you very much. I highly appreciate your effort.

1 Like

If you’re running it on a front-end button (looks to be the case from your screenshot), the “current date/time” function will be deleting any “thing” that has the date set before the current date. For instance, you have a record set as 27th January 8:00am and you run the function on 27th January 10:00 am, it will see that item as being “in the past” and delete it.

At least, this is what I reckon is the problem you’re facing from the context.

To avoid this, you could always use the “set hours to 0” function and then the “set minutes to 0” function after “Current Date/Time”, much like I did for running the recursive workflow in the backend example! This will make sure it only deletes items from before today :slight_smile:

Hope this helps!

Kind Regards,
Joseph @


Amazing! Thanks for your help!

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