Sub topic 1
What you are backing up and why
Prerequisites
This chapter assumes you know the basics of Salesforce objects, records, and fields. You should be able to open a sandbox or Developer Edition org with an administrator profile. You should also be comfortable reading CSV files and running commands in a terminal. Later chapters use these skills. This chapter only sets the goals.
Data and metadata are different backups
A Salesforce org holds two kinds of content, and each needs its own backup.
- Data is the records in your objects: accounts, contacts, opportunities, tasks, and attachments. You export it as rows, usually CSV files.
- Metadata is the configuration that defines the org: custom objects and fields, Apex classes, flows, page layouts, and permission sets. You retrieve it as XML files, usually into a version-controlled project.
Backing up one does not protect the other. A CSV of accounts will not rebuild a deleted custom field. A metadata retrieve will not bring back deleted records.
Why a backup is still needed
Salesforce keeps its platform running, but your data can still be damaged by people in your own org. Common causes are:
- A bulk update or delete that touches the wrong records.
- An integration or flow that overwrites good values.
- A deployment that removes or changes a field.
- A user with broad access who deletes data by mistake.
The Recycle Bin recovers some deleted records for a limited time. It does not undo an overwritten field value, and it does not cover metadata. An export you control does.
Set recovery goals
Before you choose a tool, decide how much loss you can accept. Two terms describe this.
- Recovery point objective (RPO) is how much recent change you can afford to lose. If you export nightly, your RPO is about 24 hours.
- Recovery time objective (RTO) is how long you can take to get back to a working state after a failure.
Set separate goals for data and metadata. Metadata changes only when someone deploys or edits configuration, so a retrieve after each change often works. Data changes constantly, so it needs a regular schedule.
| Goal | Data | Metadata |
|---|---|---|
| What it protects | Records and their values | Configuration and code |
| Typical format | CSV | XML |
| Typical frequency | Daily or weekly | After each change |
| Stored in | Secured file storage | Version control |
Decide what to protect
You rarely need every object. List the objects whose loss would stop the business, such as Account, Contact, and Opportunity, then add custom objects and any files or attachments you cannot recreate. Note which objects depend on others, because a restore must load parents before children. A later chapter covers that order.
Exercise
A nightly CSV export of all accounts and contacts is running. A teammate deploys a change that deletes a custom field, and you must restore it. Why does the CSV export not help, and what would?
Show answer
The CSV export contains record data, not configuration. A custom field definition is metadata, so you need a metadata backup, such as a package.xml retrieve stored in version control. The nightly export would help only with restoring the values that were in that field.