Bulk operations
This section covers bulk operations, which lets you run API workflows on a list of things directly from the Bubble database editor
Bulk operations let you execute workflows on a large set of data within the editor. By scheduling a pre-defined on the provided list, you can perform the same wide array of actions on a list of that you can do in your app.
Note on emails: the bulk operation cannot be used to mass send emails.
Note: Bulk operations are performed server-side, but the scheduling relies on client-side actions that depend on your browser window staying open and active.
In other words, you need to keep the popup open for them to continue until the process is done.
What are bulk operations?
In the context of the Bubble database, bulk operations are any kind of process that you apply to multiple things simultaneously or sequentially. While the Make changes to a list of things action is technically a bulk operation, we generally mean working on longer lists (100+ things) and sometimes more advanced processing. We'll look into a case example below.
Bulk operations are typically done using one of four methods:
Schedule API workflow on a list
The Schedule API workflow on a list action is a way to run an API workflow on a list of things. This means that you can apply an action to a thing in isolation. For example, if you have a list of users, you can use this action to update each user's profile, send emails, or perform other tasks for each user on the list, all in a single operation. It's a powerful tool for batch processing, allowing you to execute workflows efficiently and simultaneously on multiple data entries.
The fastest and most way to do bulk operations
The quickest and simplest way to set up in the Bubble editor
Runs workflows in parallell
Stable and reliable
Can be executed directly from the Bubble editor using the Bulk feature
Runs in the , meaning that it doesn't matter if the user closes their browser tab
Article: Scheduling API workflows
Recursive API workflows
are not technically a Bubble feature, but an alternative method for processing lists of things. Instead of scheduling all the workflows in one action (Schedule API workflow on a list), a recursive schedules only one API workflow, and an action inside of that workflow re-schedules that same workflow again. This makes the operation different in a few ways:
Somewhat slower and less WU-friendly
Runs in sequence, rather than parallell
Can use data from a previous cycle in the new cycle
You can control the timing of each cycle dynamically
Can if the operation places too high a demand on the server
For most scenarios, Schedule API workflow on a list is your most performant and reliable method, but for added flexibility in terms of dynamic parameters, or if for any reason you need the actions to be executed sequentially, you can use recursive workflows.
Article: Recursive API workflows
The bulk feature
The bulk feature is an in-editor operation that you ran run directly from the database editor. Technically, this does the same as scheduling an API workflow, where you select an API workflow to run, and it will process the currently viewed list of things, or the things you have selected.
The bulk feature only supports one parameter: the list of things you want to make changes to
You don't need to add any events in your app (such as a button click) – it can be executed from the Bubble editor
Since this is an extension of the Schedule API workflow on a list function, the processing will be done in parallell, as opposed to in sequence
Make changes to a list of things
This is an action that can be triggered both in the front-end and back-end. It makes changes to multiple things at once, but does not process the things one-by-one. Make changes to a list of things is good for making simple changes to a maximum of a few hundred things. For longer lists, or where you require more dynamic options in what to change, one of the above methods is recommended.
There are also actions for copying a list of things and deleting a list of things. These two should only be used for shorter list.
Reference: Make changes to a list of things | Delete a list of things | Copy a list of things
Defining an API workflow
Before you can perform bulk workflows on your data, you need to define the API workflows that you are going to call.
Valid API workflow parameters
To be valid for scheduling by the Bulk operation feature, APIworkflows must have a few properties in place:
A thing parameter: the workflow must include a parameter that requires a 'thing' of the same data type as the one you intend to perform the bulk operation on

Only set up one parameter: when a bulk operation is called, Bubble will only fill one parameter: the thing it's currently scheduling the operation on. In other words, do not set up any other parameters.
The thing cannot be a list: bulk operations are scheduled one-by-one on a list of things. In other words, the parameter that asks for which thing to perform the operation on should ask for a single think, not a list/array.
It does not need to be exposed as a public API Workflow: while it will still work if you expose it, it's better to uncheck the checkbox to make sure that it cannot be triggered from outside of your app.
Adding actions
Now we have an API Workflow that accepts a single parameter: the thing that we want to run the operation on. In our example we set that thing to a custom data type called Product, so let's make a change to that thing. We have a on the product called Published that we want to set to yes.
In our API Workflow, this is a very simple operation:

First, we add the Make changes to a thing action to the API Workflow
Then, we choose product as the thing we want to change. This is the parameter we set up earlier.
Finally, we set the Published field on the product to yes
Running the bulk operation
Now that we have the workflow we want to run the bulk operation on, let's see how we trigger it to run.

First, we select the data type that we want to run the bulk operation on. In this case, we want to work with Products
Next, select the Products that you want to run the operation on. Trucker cap and Baseball cap are ready to be published, but Product 1 still needs some work, so let's just check to two top ones.
Then, we click the Bulk button, where we'll select with API Workflow to run on the selected things.

In the first dropdown, we choose what list to run the operation on. You can choose to run it on the entire current view, or the selected entries – in our case we specifically selected two entries, to let's go with that
In the second dropdown you will find the list of compatible API Workflows. If the Workflow does not accept the same data type as a parameter, it will not be selectable
The text next to point three confirms that the workflow will in this case be run on 2 entries, which is what we selected
Finally, we can click Run workflow and the operation will start. Since we are only making a small change on two entries, it should finish very quickly.
Looking again at the data in our database, we can see that the two data types we selected now have their Published field set to yes.

Combining bulk operations with views
Views let you filter the data displayed in the database editor by specific constraints, just like the Do a search for data source. Since bulk operations let you run the operation on all records in the current view, you can combine these features to flexibly run bulk operations on things that match specific criteria, instead of manually selecting the things in the list.
To set up a new view, click the New view button or the pencil icon next to the data type you want to run an operation on.
Case 1: Using the Bulk feature in the database editor to change a list of users
In the first case, we'll make a fairly simple change to a list of Users. We're going to assume that you already have a collection of users in your app, and you want to introduce roles for these users, such as admin and regular user. Furthermore, we'll assume that all registered users thus far will be regular users, meaning that we can apply the change to all users in the database.
The roles are saved in an called Roles.
What we would to do is:
Search for all users without any constraints
Specify the role we want those users to be assigned
Save that value in the Role field (option set) saved on the User data type.
This is an operation we can run directly from the Bubble database editor using the Bulk feature.
Since we want to apply it to all users, we don't need to set up any constraints. We can apply the bulk operation to all Users in the database.
We only need to send one parameter (the list of Users), and can specify the Role option set to apply to those users in the API workflow itself, since it's the same for everyone
We'll assume you have already set up the fields and option set needed. First, let's have a look at what that API workflow needs to look like:

Let's go over the two points:
We've given the API workflow a fitting name, and made sure it's not exposed publicly, since we don't want to trigger this workflow from an external system
We've set up a parameter called user, and set the type to User
Note that point two is not a list. This is because the Schedule API workflow on a list action handles items individually. In other words, one workflow runs per item in the list – it doesn't make changes to the entire list in one operation (even if the workflows are executed in parallell).
Let's check out the action that makes changes to the User:

Since all users will have the same role, we specify the value directly as a static value in the user. The data source is set to the option set Roles, and the value Regular user.
And we're done! Let's see how we would run that from the Bubble editor:

As you can see, the Role field on all Users is empty as of now. Click the Bulk button in the top-right corner to start the process. This brings up the window below:

First, we pick the workflow that we created earlier. This is listed as a valid choice for two reasons:
The API workflows has only one parameter: User.
We are currently looking at the list of Users in the database.
Then, click Run workflow.
In this example, we had only five things to change, and the operation will normally finish in less than a couple of seconds.
Case 2: Adding a discount to a list of Products from your app
Let's say that you are running an eCommerce store, and you have a list of a custom data type called Products that your customers can buy. We also have a list of You make the decision to discount products from a specific vendor by 25%, and you store that discount in a field on each product called Discount. Each Product already has a field called Price, that reflects the regular price of the product.
What we would need to do in that case, is:
Search for all Products from that Vendor
Specify a discount to add
Save that value in the Discount field on each of the Products found in step 1
We are going to use Schedule API workflow on a list to make the changes. In this example, we can't use the Bulk feature in the Bubble editor, for two reasns
We need to search for the correct Vendor in the database (database views cannot specify a database thing as a filter)
We need to send multiple parameters (the Product to change and the discount value) (The Bulk feature only supports one parameter – the thing to change)
Instead of using the bulk feature, we'll set up a very simple form that accepts two parameters, as well as a button that starts the operation:

With that form set up, we can choose a Vendor from the database, specify a discount, and then click the button to start the Schedule API workflow on a list process. As we explored earlier, shortly after the button has been clicked (Bubble's loading bar will show), the operation starts on the Bubble server, meaning that you can close the browser tab and the operation will continue to run until it's finished. The time it takes to schedule the workflow can vary somewhat depending on the length of the list.
For the next step, we're going to set up the scheduling action when the button is pressed. Right-click the button and select Start/Edit Workflow in the dropdown menu or click ⌘ + K / Ctrl + K to create the in the .

Let's go over the screenshot point-by-point:
First, we search for the Products we want to process
We specify the Vendor selected in the dropdown as a constraint
The scheduled date we want to process the list: makes sure we run it immediately.
This field specifies what we want to make changes to. In our case, we want to make changes to each product in the list. By setting the data source as This product, we specify that the changes should be applied to the individual Product currently being processed by this specific API workflow.
Finally, we use the Input discount field's value as the data source for the discount to apply
This kind of workflow can be used both in one-off scenarios, or as a standard feature in your app. As we've seen, it's quick to set up and will reliably finish even on long lists of things.
Other ways to learn
Last updated
Was this helpful?