Creating, saving and deleting data
This article covers how to work with the data in your database by creating, changing and deleting things
Bubble comes with a range of ways to work with the data in your database:
Create new things
Make changes to existing things
Delete things
You can manipulate data in the database in three different ways:
Trigger actions on a specific event, such as the user clicking a Save changes button.
Automatically save changes to the database as soon as the user provides input in a field.
Edit data directly in the database. Access to the database editor may be restricted by Collaboration settings.
Workflows
A workflow is a collection of actions that run in sequence whenever an event happens. You can choose from many different types of events, such as a button click, an input field being updated, or a specific condition becoming true.

Actions
A few different actions make changes to the database. Click the links below to see the core reference entry for each one:
Creates a new record of a specific data type, and optionally saves information in its fields.
Saves new information to a thing, replacing whatever was in the field before.
Same as above, but works on multiple things at once.
Same as above, but works directly on the user who started the workflow.
Deletes a thing from the database.
Same as above, but for multiple records.
Creates an identical copy of a list of existing things, each with a new unique ID and updated Created date and Modified date fields. You can copy up to 50 things in one operation. To copy one thing, use the :converted to list operator to convert a single thing to a list containing just that one thing.
By combining these actions in different ways, you can work with new and existing data flexibly, and add other actions, related or unrelated to the database, alongside them.
Example
Say you've set up a form that lets a user edit their own profile. You'd have a few input fields where the user can provide information, and a button that triggers the workflow.

With this setup, no changes are saved to the database until the user clicks the button.
Some information, like email and password, has to be changed using a different action from Make changes to a thing. Because of the sensitive nature of user credentials, they need to be handled differently to protect their security and the user's privacy.
Article: User accounts
Workflows let you add further actions after the first one, to perform other relevant tasks. For example, you could use the alert element to display a message once the operation succeeds:
As this example shows, workflows are useful when you want the user to decide when to save changes, or when you need to chain more than one action together.
Auto-binding
Auto-binding means binding an input element to a specific field on a data type. Once this is set up, Bubble automatically saves any changes made in that element to the database, so you don't need to set up any actions to make it happen.
Auto-binding is tied to a field, so the data format of the input element and the field must match. For example, a field that holds a date must be connected to an input element that expects a date from the user.

Auto-binding only works if the parent of the input element has a data type loaded into it, and it can't create new things, only write to things that already exist.
In the example above, we've set up a text input element that automatically saves its input to the Name field on the user. The user is loaded into the parent, which is either a container element or the page itself.
The data saves whenever the element loses focus, meaning the user has clicked or tabbed away from the input field. Bubble briefly shows a loading bar to let the user know the data is being saved.
Auto-binding on an input runs immediately, rather than waiting for the "next step" when you're using the step-by-step feature in the debugger.
Showing an alert on success
When auto-binding is active, you can show an alert to let the user know it worked. First, place an alert element on the page. Then check Show an alert on success to select which alert element to use and what message to show.
In the screenshot above, we've created an alert element and checked Position the alert at the top, so it displays as a full-width bar at the top of the page.
On the input with auto-binding enabled, we've picked the alert element we just created, along with a custom message that matches the field being changed.
Comparing workflows and auto-binding
There are a few key differences to weigh when choosing between workflows and auto-binding.
UX
The first is how it affects the user experience. In some forms, it makes sense to let users review their information before anything saves, until they click a button. In others, it's more efficient to save information as soon as a field is edited. It's up to you as the developer to decide what fits best in each case.
Security
Bubble handles security on actions and auto-binding a bit differently. With actions, you control editing rights with conditionals on the workflow. With auto-binding, you control editing rights with privacy rules.
Workflows
Workflows aren't affected by privacy rules and need their own conditional expressions to control who can do what. For example, in the action below, we've set up an expression that only allows a user to edit a profile if it's their own:

Auto-binding
Auto-binding relies on a dedicated privacy rule that dictates under what circumstances changes to the field will save. The field stays editable, but when it loses focus, it generates an error message if privacy rules don't allow the user to save changes through auto-binding.

Performance
Workflows and auto-binding also differ slightly in how they perform:
Workflows send all the changes that need to be made in one batch to the server. This means fewer slowdowns, but the ones you do have may take a bit longer, depending on how much data is transferred.
Auto-binding sends updated information to the server immediately when a field is edited. This means more frequent, but typically shorter, data transfers.
There's no single right answer here. The difference is often small enough to be negligible, but it's still worth weighing against the overall user experience to decide which method fits best.
The database editor
Bubble also lets you edit data directly in the built-in database editor. This works for both the Development database and the Live database.
You'll find the database editor in the Data tab, under App data. Select the data type you want to edit, search for a specific thing, and click the edit icon to make changes.
Editing directly in the database is useful for quick updates, but as a long-term solution, we recommend setting up your own forms to edit data instead.
FAQ
FAQ: Creating, saving, and deleting data
Other ways to learn
Last updated
Was this helpful?