# How to delete database things in Bubble

- Tool: Bubble
- Difficulty: Intermediate
- Time required: 15-20 min
- Compatibility: All Bubble plans (bulk operations require Starter+)
- Last updated: March 2026

## TL;DR

Deleting records in Bubble uses the Delete a Thing action for single records and Schedule API Workflow on a List for bulk deletions. This tutorial covers safe deletion patterns including soft delete with a flag, cascading related records, bulk delete operations, and undo functionality.

## Overview: Deleting Database Records in Bubble

Deletion is permanent in Bubble — there is no undo or recycle bin. This makes it critical to implement safe deletion patterns. This tutorial covers single and bulk deletion, soft delete alternatives, and handling related records.

## Before you start

- A Bubble app with Data Types containing records
- Understanding of Bubble workflows and data relationships
- Backend workflows enabled for bulk operations (Starter+)

## Step-by-step guide

### 1. Delete a single record with Delete a Thing

In a workflow, add the action Data → Delete a Thing. Set the Thing to delete using the appropriate context: Current cell's DataType in a Repeating Group, a search result :first item, or a result from a previous step. Bubble permanently removes the record. Add a confirmation step before deletion — show an Alert or Popup asking Are you sure you want to delete this? with Confirm and Cancel buttons.

> Pro tip: Always add a confirmation dialog before deletion. Accidental deletions cannot be undone in Bubble.

**Expected result:** The selected record is permanently removed from the database after user confirmation.

### 2. Implement soft delete instead of hard delete

Soft delete marks a record as deleted without actually removing it. Add a field called deleted (yes/no, default: no) to your Data Type. Instead of Delete a Thing, use Make Changes to Thing and set deleted to yes. Update all your searches to include deleted = no as a constraint. This lets you restore accidentally deleted records and maintain historical data.

**Expected result:** Records are flagged as deleted but remain in the database for potential recovery.

### 3. Handle cascading deletions of related records

When you delete a parent record (e.g., a Project), related child records (e.g., Tasks, Comments) still exist as orphans. Before deleting the parent, search for all related records and delete them first. Create a workflow that: (1) Searches for all child records referencing the parent. (2) Deletes each child record. (3) Deletes the parent record. For multiple child types, delete them in the correct order.

**Expected result:** Deleting a parent record also removes all related child records, preventing orphaned data.

### 4. Bulk delete records with Schedule API Workflow on a List

For deleting many records at once, create a backend API workflow called delete-single-record that takes a Thing parameter and deletes it. In your frontend workflow, use Schedule API Workflow on a List with the list set to your search results and the workflow set to delete-single-record. This processes each deletion server-side without freezing the browser.

**Expected result:** Large numbers of records are deleted reliably via background processing.

### 5. Add undo functionality with temporary soft delete

For a better user experience, implement a temporary undo window. When the user clicks Delete, set deleted = yes and show a toast notification with an Undo button that sets deleted back to no. Use a Do When Condition Is True or scheduled workflow to hard-delete the record after 10 seconds if the user does not click Undo.

**Expected result:** Users have a brief window to undo deletions before they become permanent.

## Complete code example

File: `Workflow summary`

```text
DELETION PATTERNS SUMMARY
==========================

PATTERN 1: Hard Delete (single record)
  Workflow: Delete button clicked
    1. Show Popup: ConfirmDelete
    2. Confirm button: Delete a Thing → Current cell's Record

PATTERN 2: Soft Delete
  Data Type field: deleted (yes/no, default: no)
  Delete workflow: Make Changes → deleted = yes
  All searches: add constraint deleted = no
  Restore: Make Changes → deleted = no
  Cleanup: Backend workflow periodically hard-deletes records where deleted = yes AND Modified Date < 30 days ago

PATTERN 3: Cascading Delete
  Workflow: Delete Project button clicked
    1. Schedule API on List: Search Tasks (project = This Project)
       → delete-single-task workflow
    2. Schedule API on List: Search Comments (project = This Project)
       → delete-single-comment workflow
    3. Delete a Thing: This Project
    (Order matters: delete children before parent)

PATTERN 4: Bulk Delete
  Backend workflow: delete-single-record
    Parameter: record (DataType)
    Action: Delete a Thing → record
  Frontend workflow:
    Schedule API Workflow on a List:
      List: Search for Records (condition)
      Workflow: delete-single-record

PATTERN 5: Undo Delete
  1. Make Changes → deleted = yes, deleted_at = Now
  2. Show toast: "Deleted. [Undo]"
  3. Undo click: Make Changes → deleted = no
  4. Scheduled cleanup: Delete things where deleted=yes AND deleted_at < 10 seconds ago
```

## Common mistakes

- **Deleting records without a confirmation dialog** — Accidental clicks permanently delete data with no way to recover in Bubble Fix: Always show a confirmation popup or dialog before executing the Delete a Thing action
- **Not deleting related child records before the parent** — Orphaned records remain in the database referencing a parent that no longer exists, causing display errors and data bloat Fix: Search for and delete all related child records before deleting the parent record
- **Using Delete a List of Things from the frontend for large datasets** — This runs client-side and can freeze the browser or time out for large lists Fix: Use Schedule API Workflow on a List for bulk deletions of 100+ records

## Best practices

- Always add a confirmation step before permanent deletion
- Consider soft delete for critical data to enable recovery
- Delete related child records before parent records to prevent orphans
- Use Schedule API Workflow on a List for bulk deletions
- Add a temporary undo window for better user experience
- Implement a cleanup workflow that periodically hard-deletes old soft-deleted records

## Frequently asked questions

### Can I recover a permanently deleted record?

No. Once you use Delete a Thing in Bubble, the record is permanently removed. There is no recycle bin or undo feature. This is why soft delete is recommended for important data.

### Does deletion free up storage?

Deleting records frees database storage, but files (images, documents) associated with deleted records remain in the File Manager until manually deleted.

### How much does a deletion cost in WUs?

A single Delete a Thing costs approximately 0.5 WU. Bulk deletions via Schedule API Workflow cost WUs per record.

### Can I delete records via the Data API?

Yes. Send a DELETE request to https://yourapp.bubbleapps.io/api/1.1/obj/datatype/uniqueid with proper authentication.

### What happens to fields referencing a deleted record?

Fields that referenced the deleted record become empty. Searches that included the record no longer return it. Custom states holding the deleted record still reference it until the page reloads.

### Can RapidDev help with data management architecture?

Yes. RapidDev has built data management systems in Bubble including archival workflows, audit trails, cascading operations, and GDPR-compliant data deletion processes.

---

Source: https://www.rapidevelopers.com/bubble-tutorial/delete-database-records-in-bubble
© RapidDev — https://www.rapidevelopers.com/bubble-tutorial/delete-database-records-in-bubble
