# Data Management — Import, Export & Duplicates

> Data Import Wizard vs Data Loader, upsert with external IDs, duplicate and matching rules, backups.

**Track:** admin · **Category:** Data Quality · **Topics:** Data Loader, Import, Duplicates, Upsert

Read on the site: https://www.forcechallenges.com/notes/data-management

## Import Wizard vs Data Loader

| | Data Import Wizard | Data Loader |
|---|---|---|
| Where | In the browser (Setup) | Desktop app / command line |
| Volume | Up to **50,000** records | Up to **5 million** |
| Objects | Common standard objects + custom objects | All objects that support the API |
| Delete / export | ❌ | ✅ insert, update, upsert, delete, hard delete, export |
| Scheduling | ❌ | ✅ (command line) |
| Duplicate prevention | Built-in matching for some objects | Use upsert / duplicate rules |

## Upsert with an External ID

Upsert = **insert or update** based on a matching key.

```csv
ERP_Id__c,Name,Industry
ERP-1001,Acme Corp,Technology
ERP-1002,Globex,Energy
```

Map `ERP_Id__c` (External ID) as the match field → existing records update, new ones are created. You can also link parents by their external ID (e.g. Contact `Account:ERP_Id__c`), so you never need Salesforce Ids in the file.

## Load order and tips

1. Load **parents before children** (Accounts → Contacts → Opportunities).
2. Turn off or bypass noisy automation / validation for one-time migrations (and turn it back on).
3. Keep **Ids and error files** from each load.
4. Test in a **sandbox** first.
5. Mind the **batch size**: smaller batches if triggers hit limits.

## Duplicate management

- **Matching rule** — *how* records are compared (exact / fuzzy on name, email, phone…).
- **Duplicate rule** — *what happens*: **Allow** (with alert/report) or **Block**, on create and/or edit.
- Duplicate rules also run for API and Apex saves (unless allowed with headers / `DMLOptions`).
- Use **Merge** on Accounts, Contacts and Leads to combine duplicates.

## Backups & recycle bin

- Deleted records stay in the **Recycle Bin for 15 days**.
- **Data Export** (weekly/monthly) or **Backup & Restore** for real backups.
- **Hard delete** (Data Loader) skips the recycle bin.

## Interview questions

1. *You need to load 200,000 contacts linked to accounts from an ERP — how?* → Data Loader upsert with external IDs, parents first.
2. *Matching rule vs duplicate rule?*
3. *How long do deleted records stay in the recycle bin?* → 15 days.

---
Source: ForceChallenges · last updated 2026-10-03
