Deleting on a Schedule - Help Please

Hello all,

I can’t find the example here in the forum that I’m looking for. Can someone point me in the right direction.

I am trying to have the user just “delete” something, which just hides it from their sight instantly.

I have created a data type called Delete so when the user “deletes” something then it just marks it in the data as “DELETE” so it can be scheduled later to delete behind the scenes.

My goal is to just delete all the things that were deleted on a certain schedule, like for example every week on Monday at 2:00am my time.

I think i saw something like this in the forum before and can’t find it now. Or you can just explain it to me. Thanks :slight_smile:

Not sure if I understand correctly, but I’ll take a shot anyway.

What are the benefits of deleting everything on a schedule, as opposed to when the user clicks “delete” … that would probably be the easiest solution… And it would “hide it from their sight instantly”…

You’d do this in a workflow, like when “delete button” is clicked>delete a thing> thing to delete = thing selected/parent groups thing…

Now that I am typing this out… I see… you have “things” … can you assign those things a data type “active” (a yes/no)… those things should be ‘yes’ by default. When the user clicks them, and then uses action delete, you could change that things type to “no”. Then you could only show that thing when “active” is “yes”. Then you could have a repeating workflow… Delete thing(do a search for things, where “active” = “no”, and schedule it out weekly with a repeatingn workflow, or cron job?

Does that help?

Ya, the thing i am deleting is very large and although it looks like it is deleted from the users perspective bubble seems to take a while to delete it on the backend because it interferes with the user doing other tasks.

I am trying to schedule a weekly repeating workflow basically, i guess, so it does this more behind the scenes. Any idea how to do that?

I think @andrew6’s answer should work for you. As he suggests, when the user clicks delete, you should use a workflow action to set a boolean field on the record, e.g active = no, or delete = yes. Then you have a recurring API workflow that runs on a list of records with delete = yes and has an action to delete each item in the list. I think you need a professional Bubble plan to run weekly recurring workflows, so as andrew6 suggests, you can use a cron job 9 (or a Zapier scheduled event) to call your API workflow every week.

i’ve just ran into a pretty cool feature, that might solve this issue a little better. After exploring cron jobs myself, and not loving the pieces needed /ease of use.

Can you simply create a custom event > to run when current time = 2:05 am, then set that custom event to trigger an api workflow that deletes things with the data field set to “active” = “no”.

Basically, this should run the deleting process every morning at 205am

If you mean a custom event on the page then I think this will only run at the scheduled time if the user stays on the page. If they navigate away then I don’t think it will run. You want to schedule an API workflow on the server.

Ya, i think you are correct.

Ohhh, maybe thats why i can’t figure it out. I am only on a personal plan, not professional. Thanks for that.