Forum Academy Marketplace Showcase Pricing Features

Delete multiple image list form one record

I have a database containing two fields, location (text) and image (list of images).


Now I want to remove a record from the database but I also want to remove all the images from bubble file manager (in this example 3).
I know how to do that with one image (delete an uploaded file) but how do I delete a list of images of that record?
Thanks in advance,

Do the same thing you’d do for a single entry but put it in a recursive backend workflow.

1 Like

From delete an uploaded file have you, then, tried ( do a search for ) items that pertain to that record?

@boston85719 has the right of it, you’re going to want to set up an API Workflow in your Backend Workflows to handle this.

What you’ll want to do first is enable Backend Workflows in your project, if you haven’t already. This can be easily done via Settings → API → “Enable Workflow API and backend workflows”

Once you’ve done that, you’ll be able to see “Backend Workflows” in your list of pages, nicely tucked away at the bottom.

Here we can create a “New API workflow” and add a new parameter.

You can call this whatever you like, but make sure you have the correct data type selected!

Make sure you’ve not set this as “Is a list/array” as we need to process images one at a time.

Final step for this workflow is just adding the “Delete an uploaded file” action with the URL being “https:[parametername]'s URL”. (You’ll want to add the ‘https:’ yourself as that is usually omitted)

Now that’s done, go back to your delete function and add the action Custom Events → “Schedule API Workflow on a list”.

Point it to your newly made API Workflow and set the “List to run on” as your item’s list of images.

Finally, set the value of your parameter to be “This image” and you’re good to go! (Example below)

When this button is pressed, the system will go through each image, one at a time and delete them all for you :slight_smile:

Please let me know if you have any questions about this!

1 Like

@wilco I personally would avoid using the backend workflows on a list as Bubble engineers have told me to avoid them and use recursive backend workflows instead.


  1. Every workflow has a default 5 minutes to run and complete before timeout, so a workflow on a list gets 5 minutes to run through the entire list as it is considered a single workflow, however, recursive workflows which ‘loop’ through a list and do a single item from the list at a time, are running a separate workflow for each item in the list (ie: each loop is a new workflow) so you get 5 minutes per item in the list.

  2. There is no way to know when a backend workflow on a list is finished (as far as I know), and so there is no way to have other actions that will occur after the list has finished processing. However, a recursive backend workflow will know when the last item in the list has been processed and can have actions triggered after the final item has been processed to do other things like trigger the backend workflow you will use to then delete the data entry. You just use conditionals on those other actions to trigger.

  3. It is easier to debug a recursive backend workflow rather than a backend workflow on a list because in your logs you can see each loop as separate workflows rather than just the single instance of the backend workflow on a list, so if a particular item in the list somehow causes an issue, you can isolate which item in the list causes the issue and resolve.

If you do not know how to structure backend recursive workflows there are plenty of threads on the topic in the forum to review how to set them up properly.

Additionally, you may decide not to have the database structured with a field that is a list. Reasons:

  1. Fields that are list of things are fetched slower once the list exceeds 50 items or so when compared to doing a search for a separate data type.

  2. Fields that are a list have max of 10,000 items

  3. Fields that are list can not have other data fields related easily…for me this is most important when working with images as I usually will want to allow there to be a sort number for the images so the user can sort them in the order they want them to appear after they have uploaded them as that is something people would want for a good UX…additionally can add a title or description to the image so the user can help people to understand what the image is of, which is highly important for property photos, product photos etc.

  4. Performance…instead of the data type which will likely be searched needing every entry to return all URLs of all photos in the field as a list, you can simply have the single image you want to display in search results as a text field (saving the URL of the image with sort number 1)…then I have a separate data type I call ‘images’ and that will have a related field of ‘thing’ (maybe product) so I know which product the images belong to when I search them.

This way my search is optimized for performance while still showing the image I want displayed in search result, then when user selects a thing to see more details about I can easily fetch the list of images for that specific thing.

Lastly, when deleting the image from file manager just use the images URL which can be accessed via the dynamic expression by using the operator of URL after the image is set as the data source. With that no need to add static text values of https.

1 Like

Okay thanks for the information. I keep it in mind, in this case it’s max 10 image files to delete.