Hey guys,
How can I delete an entry from the database after 15 or 30 days?
Like I have a Job Opportunity database. We create multiple entries in it every day. I wanna auto delete the entries after 15 or 30 days from its creation date.
How can I achieve this?
“On creation of the entry” This is the part I’m confused
The entry is created directly on the database. It’s not created by the user
On the workflow should I schedule API on page load? Will that work?
The workflow shouldn’t happen on the client side. Here’s what you should do:
create an API work flow and add a step that “delete a list of things”.
For the “list of things” put in “do a search for Job Listings” and make one of the conditions “creation date + 30 days < current date”
add another step “schedule api workflow” and select the same workflow you just created and set the schedule date to “current date + 1 day”. This will loop the workflow so that every day bubble is checking for job listings older than 30 days and delete them automatically.
put a button on your app somewhere to initiate the workflow. (This is a one time thing and you can delete the button after)
Oh right, yeah then a recursive workflow as described by Vin should do the trick.
I would say tho, if you’re the one adding these manually, I would quickly create an admin page where you can batch add entries and have full control. I personally struggle with the limitations of Bubble’s database interface. (in their defence, it’s super easy to build your own, so time better spent elsewhere probably).
If you do set up your own page for adding entries, you could run with the first example, cancel schedules and re-promote a posting and so much more. But it all comes down to personal preference.
@casheets123@Vin
Thanks a lot for helping me out guys. I’m getting this error on the final step
On the API workflow I create a key Job opportunity = Job opportunity database
Yes & no.
You’re better off using the “delete a list” + constraints, Yes
You do need to still schedule the api workflow at the end in order to loop the deleting process
This is whats happening:
-API workflow runs at scheduled time*
-Step 1 runs > delete list of things based on “search for”*
-Step 2 runs > schedule an API workflow (this step’s parent API Workflow)*