> For the complete documentation index, see [llms.txt](https://manual.bubble.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.bubble.io/help-guides/data/the-database/creating-saving-and-deleting-data.md).

# 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[^1]
* Make changes to existing things
* Delete things

You can manipulate data in the database in three different ways:

<table><thead><tr><th width="198.015625">Method</th><th>How it works</th></tr></thead><tbody><tr><td><a href="#workflows-1">Workflows</a></td><td>Trigger actions on a specific event, such as the user clicking a <em>Save changes</em> button.</td></tr><tr><td><a href="#auto-binding-1">Auto-binding</a></td><td>Automatically save changes to the database as soon as the user provides input in a field.</td></tr><tr><td><a href="#the-database-editor">The database editor</a></td><td>Edit data directly in the database. Access to the database editor may be restricted by <a href="/help-guides/maintaining-an-application/collaboration.md">Collaboration</a> settings.</td></tr></tbody></table>

## 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.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FixsfXqyGYp0EYeqkGX3u%2Fworkflow-schema.jpeg?alt=media&amp;token=31eb1a55-017c-44c0-bcca-c09cf4608c44" alt=""><figcaption></figcaption></figure>

### Actions

A few different actions make changes to the database. Click the links below to see the core reference entry for each one:

<table><thead><tr><th width="304.3515625">Action</th><th>What it does</th></tr></thead><tbody><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#create-a-new-thing...">Create a new thing</a></td><td>Creates a new record of a specific data type, and optionally saves information in its fields.</td></tr><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#make-changes-to-thing...">Make changes to a thing</a></td><td>Saves new information to a thing, replacing whatever was in the field before.</td></tr><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#make-changes-to-a-list-of-things...">Make changes to a list of things</a></td><td>Same as above, but works on multiple things at once.</td></tr><tr><td><a href="/core-resources/actions/account.md#make-changes-to-current-user">Make changes to the current user</a></td><td>Same as above, but works directly on the user who started the workflow.</td></tr><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#delete-thing...">Delete a thing</a></td><td>Deletes a thing from the database.</td></tr><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#delete-a-list-of-things...">Delete a list of things</a></td><td>Same as above, but for multiple records.</td></tr><tr><td><a href="/pages/-MTujs88N9W-2FUmQGag#delete-a-list-of-things...">Copy a list of things</a></td><td>Creates an identical copy of a list of existing things, each with a new unique ID and updated <em>Created date</em> and <em>Modified date</em> fields. You can copy up to 50 things in one operation.<br><br>To copy one thing, use the <a href="/core-resources/data/operations-and-comparisons.md#converted-to-list">:converted to list</a> operator to convert a single thing to a list containing just that one thing.</td></tr></tbody></table>

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.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FQmnsJCalkK8pHRD7EDiH%2Fedit-user.jpg?alt=media&amp;token=0f92048d-e83e-4544-ae15-6e160f1250f5" alt="Laptop with an edit user form."><figcaption><p>In this example, we have a list of input fields where the user can provide some information and then click the button element to save those changes.</p></figcaption></figure>

With this setup, no changes are saved to the database until the user clicks the button.

{% hint style="warning" %}
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
{% endhint %}

Workflows let you add further actions after the first one, to perform other relevant tasks. For example, you could use the [alert element](#user-content-fn-2)[^2] 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

{% hint style="info" %}
Auto-binding is only available in web apps.
{% endhint %}

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.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FsWQU3OXmYhcQ5mg1Rftt%2Fauto-bind.png?alt=media&amp;token=d0a5cf55-6a4a-4941-b729-e2ecd5d7d1a5" alt="Auto-bind properties of a text input element."><figcaption><p>Enabling auto-binding lets you choose which field on the parent container's thing the input should save to.</p></figcaption></figure>

Auto-binding only works if the parent of the input element has a [data type loaded into it](#user-content-fn-3)[^3], 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](#user-content-fn-4)[^4] that automatically saves its input to the *Name* field on the user. The user is [loaded into the parent](#user-content-fn-3)[^3], which is either a [container element](#user-content-fn-5)[^5] or [the page](#user-content-fn-6)[^6] 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.

{% hint style="warning" %}
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.
{% endhint %}

<details>

<summary>Video lessons</summary>

* [Instantly modify data with auto-binding](https://youtu.be/MamNYJmZjVY)

</details>

### 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](/help-guides/data/the-database/protecting-data-with-privacy-rules.md).

#### Workflows

Workflows aren't affected by [privacy rules](#user-content-fn-7)[^7] 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:

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FdF8qcWhrCMHFcjdRlEW7%2Fwrite-conditional.png?alt=media&amp;token=4a751081-0c2b-4c80-8a5e-9c12dfe1847e" alt="Workflow editor with an action and its Only when rule highlighted."><figcaption><p>You can use conditionals to control who can make changes to what in a workflow.</p></figcaption></figure>

#### 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](#user-content-fn-8)[^8] if privacy rules don't allow the user to save changes through auto-binding.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FzpMB2aKBNBoGdaGh2CBJ%2Fprivacy-rule-auto-bind.png?alt=media&amp;token=e4713a77-4381-499c-86d4-0bee1fb62292" alt="Privacy rules with auto-binding settings highlighted."><figcaption><p>You can control who has auto-bind editing rights on a data type by choosing which fields to allow it on.</p></figcaption></figure>

### 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.

<details>

<summary>Video lessons</summary>

* [The data tab](https://youtu.be/z0L8vFsCwkk)

</details>

## FAQ

## FAQ: Creating, saving, and deleting data

<details>

<summary>What's the difference between a workflow and auto-binding?</summary>

A workflow saves changes when a specific event happens, like a button click, so the user controls when data is saved. Auto-binding saves changes automatically, as soon as the user edits a field and moves away from it. Which one to use depends on the experience you want: a workflow if you'd rather users review their changes first, auto-binding if you want changes saved immediately.

</details>

<details>

<summary>Can auto-binding create a new thing?</summary>

No. Auto-binding only works on things that already exist. The parent container's thing needs to be loaded before auto-binding can save anything to it.

</details>

<details>

<summary>Are workflows affected by privacy rules?</summary>

Not for editing rights. Privacy rules don't control who's allowed to make a change through a workflow, you need your own conditional expressions in the workflow or action for that.

Privacy rules can still affect a workflow in other ways, though. If an action involves searching for something, like a `Do a search for`, that search is still governed by whatever privacy rules control search visibility.

</details>

<details>

<summary>Is auto-binding affected by privacy rules?</summary>

Yes. Auto-binding relies on a dedicated privacy rule for each field. If the rule doesn't allow the current user to save changes, the field stays editable, but the user gets an error message when the field loses focus and the data is not saved.

</details>

<details>

<summary>Can I run additional actions after auto-binding saves?</summary>

Yes. Set up a workflow using the *An input's value has changed* event, and add your actions there. Keep in mind the auto-bind save may not have finished by the time those actions run, so if an action depends on the data already being saved, it's safer to handle the save in a workflow instead.

</details>

<details>

<summary>Can I show a confirmation message when auto-binding saves successfully?</summary>

Yes. Place an [alert element](/help-guides/design/elements/web-app/visual-elements.md#alert) on the page, then check *Show an alert on success* on the input with auto-binding enabled. You can pick which alert element to use and customize the message.

Note that auto-binding and alert elements are only available in web apps.

</details>

<details>

<summary>Why does my input's data format need to match the field?</summary>

Auto-binding connects an input element directly to a field, so whatever the input collects has to match what the field expects. For example, a date field needs an input that provides a date, not plain text.

</details>

<details>

<summary>How do I edit user email or password?</summary>

You can't use *Make changes to a thing* for these. Because of the sensitive nature of user credentials, they need their own dedicated actions to keep them secure. You need to use the [Update the user's credentials](/core-resources/bubble-workflows/bubble-actions/account-actions.md#update-the-users-credentials) action

</details>

<details>

<summary>Can I edit data without setting up a form?</summary>

Yes. The database editor lets you edit things directly, without workflows or forms. You'll find it in the *Data* tab, under *App data*. It's useful for quick fixes, but for anything ongoing, we recommend building your own forms instead.

</details>

<details>

<summary>Is there a performance difference between workflows and auto-binding?</summary>

A small one. Workflows send all changes in a single batch, which usually means fewer but slightly longer transfers. Auto-binding sends each change as soon as it happens, which means more frequent but typically shorter transfers. In practice, the difference is often negligible, so it's usually not the deciding factor.

</details>

## Other ways to learn

<details>

<summary><mark style="color:blue;">Video lessons</mark></summary>

* [The data tab](https://youtu.be/z0L8vFsCwkk)
* [Instantly modify data with auto-binding](https://youtu.be/MamNYJmZjVY)

</details>

[^1]: A *thing* is an individual record in the database, such as a specific user.

[^2]: The **alert element** lets you flash a message to your users for a brief period. It's useful for notifications, warnings, welcome messages, and other content that doesn't need to stay on the page for long.

    **Reference:** [The alert element](/core-resources/bubble-elements/element-properties/web-element-properties/visual-element-properties/alert-element.md)

    **Video:** [How to use the alert element](https://www.youtube.com/watch?v=Die7FRWEsbY\&embeds_euri=https%3A%2F%2Fcdn.iframe.ly%2F\&feature=emb_imp_woyt)

[^3]: Container elements, such as a group, can have a database thing loaded into them. This lets each child element reference that data to display content, auto-bind input elements, and use it in workflows.

    **Article**: [The element hierarchy](/help-guides/design/elements/the-element-hierarchy.md)

    **Article section**: [Loading data into containers](/help-guides/design/elements/web-app/containers/groups.md#loading-data-into-a-group)

[^4]: The **text input** element accepts text and numbers in different formats from the user.

    **Article section:** [Text input elements](/help-guides/design/elements/web-app/input-forms/text-and-numbers.md#input)

[^5]: Containers are used to contain elements and control how they behave on the page. The most common container element is the group.

    **Article**: [The element hierarchy](/help-guides/design/elements/the-element-hierarchy.md) **Article series**: [Containers](/help-guides/design/elements/web-app/containers.md) (web)

[^6]: The page is the top level of the element hierarchy and contains all other elements.

    Article: The element hierarchy Article: The page

[^7]: **Privacy rules** let you define database rules that prevent users from seeing or modifying data they shouldn't have access to. They're applied on the server side.

    **Article**: [Protecting data with privacy rules](/help-guides/data/the-database/protecting-data-with-privacy-rules.md)

[^8]: The default error message is "Sorry, you do not have permission to modify this."

    You can change this text in your app's *Application texts and messages*, in the *Settings* tab under *Language*. Look for the string called NO\_PERMISSION.
