🗑️ Mass Delete: Safe Bulk Deletion Guide

⚠️ Critical: Mass Delete permanently removes records. Always test in sandbox, backup data, and use preview mode before executing deletions.

Mass Delete safely removes thousands of unwanted records with advanced query filtering, preview confirmation, audit trail, and recovery options. Clean test data, remove duplicates, and manage data lifecycle with confidence.


🎯 Core Safety Features

👁️ Preview Mode

  • Review Before Delete: See exact records
  • Record Count: Confirm quantity matches expectation
  • Sample Display: View first 100 records
  • Export List: Download CSV of records to delete
  • Cancel Anytime: No changes until confirmation

📋 Audit Trail

  • Deletion Log: Who, what, when for every delete
  • Record IDs: Archived for recovery
  • Field Values: Snapshot before deletion
  • Query History: SOQL used for selection
  • Compliance Reports: Export audit logs

♻️ Recovery Options

  • Recycle Bin: Soft delete (15-day retention)
  • Bulk Restore: Undelete multiple records
  • Permanent Delete: Hard delete with confirmation
  • Export Before Delete: Backup to CSV
  • Related Records: Handle child records

🔒 Safety Controls

  • Query Validation: Verify SOQL syntax
  • Max Record Limit: Batch size caps
  • Confirmation Prompts: Multi-step approval
  • Role-Based Access: Restrict delete permissions
  • Sandbox-Only Mode: Prevent production deletions

📋 Common Deletion Scenarios

Scenario 1: Remove Test Data

Goal: Delete all test Leads created during training

  1. Object: Lead
  2. Query: LastName LIKE 'TEST%'
  3. Preview: 1,234 records found
  4. Export backup CSV
  5. Execute soft delete (Recycle Bin)
  6. Result: Test leads removed, recoverable for 15 days

Scenario 2: Clean Old Opportunities

Goal: Remove closed-lost Opportunities older than 2 years

  1. Object: Opportunity
  2. Query: StageName = 'Closed Lost' AND CloseDate < LAST_N_YEARS:2
  3. Preview: 5,678 records
  4. Verify no related quotes/contracts
  5. Export audit backup
  6. Execute soft delete

Scenario 3: Remove Duplicate Contacts

Goal: Delete duplicate Contacts after merge

  1. Use DEDUP-Manager to merge duplicates first
  2. Query: Email IN ('dup1@example.com', 'dup2@example.com')
  3. Preview: Verify only duplicates selected (not masters)
  4. Execute soft delete
  5. Monitor related records: Tasks, Opportunities preserved on master

Scenario 4: Bulk Delete by CSV

Goal: Delete specific records from uploaded CSV list

  1. Prepare CSV with Record IDs column
  2. Upload CSV file
  3. Preview: 342 records matched
  4. Verify IDs are correct
  5. Execute deletion

⚙️ Step-by-Step: Safe Deletion Process

Step 1: Select Records

  1. Open Mass Delete from App Launcher
  2. Select object: Lead
  3. Choose selection method:
    • SOQL Query: Custom filter criteria
    • List View: Use existing view
    • CSV Upload: Specific Record IDs
  4. Enter query: Status = 'Unqualified' AND CreatedDate < LAST_YEAR

Step 2: Preview & Validate

Validation Check Expected Result Action
Record Count 3,456 records ✅ Matches expectation
Sample Review All Unqualified + old dates ✅ Criteria correct
Related Records 0 related Tasks/Events ✅ Safe to delete

Step 3: Backup & Export

  1. Click “Export to CSV”
  2. Download includes:
    • All field values
    • Record IDs
    • Created/Modified dates
    • Owner information
  3. Save backup to secure location
  4. Document reason for deletion

Step 4: Execute Deletion

  1. Choose deletion type:
    • Soft Delete (Recycle Bin): Recommended – 15-day recovery
    • Hard Delete (Permanent): Requires additional confirmation
  2. Enter confirmation code displayed on screen
  3. Click “Delete Records”
  4. Monitor progress: “Deleting 3,456 records… 87% complete”
  5. Review completion report:
    • ✅ Successfully deleted: 3,450
    • ⚠️ Failed (locked records): 6

🔄 Handling Related Records

Cascade Deletion Rules

Parent Object Child Records Behavior
Account Contacts, Opportunities ⚠️ Blocked – must delete children first
Contact Tasks, Events ✅ Auto-deleted (cascade)
Lead Tasks, Events ✅ Auto-deleted (cascade)
Opportunity Opportunity Line Items ✅ Auto-deleted (cascade)
Custom Object Master-Detail children ✅ Auto-deleted (cascade)

✅ Safety Checklist

Before Deletion

  1. ☑️ Test query in sandbox with sample data first
  2. ☑️ Export backup CSV of records to be deleted
  3. ☑️ Verify record count matches expectation
  4. ☑️ Review sample records – check first 20-50
  5. ☑️ Check related records – will child records be deleted?
  6. ☑️ Notify stakeholders – get approval for large deletions
  7. ☑️ Schedule deletion during off-peak hours
  8. ☑️ Use soft delete (Recycle Bin) unless absolutely necessary

🚫 Never Delete Without

  • Backup: Always export before deleting
  • Preview: Review records in preview mode
  • Approval: Get manager approval for >1,000 records
  • Testing: Test query in sandbox first

🔍 Query Examples

Delete by Date Range

Lead WHERE CreatedDate < 2024-01-01 AND Status = 'Unqualified'

Delete by Custom Field

Contact WHERE Data_Quality_Score__c < 30 AND Email = null

Delete Test Records

Account WHERE Name LIKE 'Test%' OR Name LIKE '%Demo%'

Delete by Owner

Lead WHERE Owner.Name = 'Integration User' AND CreatedDate = LAST_N_DAYS:90

⚡ Performance Guidelines

Record Count Deletion Time API Method Recommendation
1 – 500 30 seconds – 2 minutes REST API Execute immediately
500 – 5,000 2 – 10 minutes REST API (batched) Monitor progress
5,000 – 50,000 10 – 45 minutes Bulk API Schedule off-peak
50,000+ 1 – 3 hours Bulk API (parallel) Split into batches

♻️ Recovery Procedures

Restore from Recycle Bin

  1. Navigate to Recycle Bin in Salesforce
  2. Filter by object type and date deleted
  3. Select records to restore (max 200 at a time via UI)
  4. Or use Mass Delete → Restore tab:
    • Query deleted records: isDeleted = true AND DeletedDate = TODAY
    • Preview restore candidates
    • Click “Restore Selected”
    • Monitor restore progress

💡 Recovery Time Limits

  • Recycle Bin Retention: 15 days (standard), 30 days (enterprise with license)
  • Hard Deleted Records: Cannot be recovered via UI
  • Contact Salesforce Support: Recovery may be possible within 30 days for hard deletes (not guaranteed)
  • CSV Backups: Keep export files for at least 90 days

🔧 Troubleshooting

Problem: “Cannot delete record” errors

Common Causes:

  • Record is locked by approval process
  • Related child records exist (Accounts with Contacts)
  • User lacks delete permission
  • Validation rules prevent deletion
  • Record in use by workflow/process

Solutions:

  • Recall approval or wait for completion
  • Delete child records first
  • Verify permissions with System Administrator
  • Temporarily disable validation rules (with approval)
Problem: Deletion taking too long

Performance Tips:

  • Split into smaller batches (10,000 records max per batch)
  • Delete during off-peak hours (evenings, weekends)
  • Remove complex triggers temporarily (with approval)
  • Use Bulk API for large deletions (auto-selected for 5,000+ records)
  • Schedule sequential batches with 10-minute gaps
Problem: Accidentally deleted wrong records

Immediate Actions:

  1. Stop deletion job if still in progress
  2. Go to Recycle Bin immediately
  3. Filter by DeletedDate = TODAY
  4. Select all deleted records
  5. Click “Undelete”
  6. If hard deleted: Contact Salesforce Support within 24 hours

Prevention:

  • Always preview before executing
  • Test queries in sandbox
  • Start with small batches (100 records)
  • Use soft delete (Recycle Bin) by default

✅ Best Practices

Deletion Workflow

  1. Plan: Document deletion criteria and approval
  2. Test: Verify query in sandbox with sample data
  3. Backup: Export CSV of records before deletion
  4. Preview: Review records in preview mode
  5. Start Small: Delete 100-500 records as pilot
  6. Monitor: Watch for errors during deletion
  7. Verify: Confirm expected records deleted
  8. Document: Log deletion in audit system

Enterprise Governance

  • ☑️ Require manager approval for >1,000 records
  • ☑️ Executive approval for >10,000 records
  • ☑️ Schedule large deletions during maintenance windows
  • ☑️ Notify users before deleting shared records
  • ☑️ Keep audit logs for 1 year minimum
  • ☑️ Review deletion patterns quarterly

📊 Deletion Audit Report

Every deletion generates comprehensive audit report:

Audit Field Captured Data
Deleted By User name and ID
Deletion Time Timestamp (UTC)
Object Type Lead, Contact, Account, etc.
Query Used Full SOQL query
Records Targeted Count from preview
Successfully Deleted Count of completed deletions
Failed Deletions Count + error reasons
Deletion Type Soft (Recycle Bin) or Hard (Permanent)

📚 Related Documentation

🔍 DEDUP-Manager

Find & merge duplicates

View Guide →

⚡ Mass Update

Bulk record updates

View Guide →

📖 Getting Started

New user guide

View Guide →

💬 Support

Get help

Contact Support →

Last updated: March 2026 | Back to Documentation | Home