Back up and restore configuration
Keep a restorable copy of the Check Sets and Checks your organization created, so you can recover them after an accidental change, move them to another org, or reinstall Record Health Check. Check Sets and Checks are Custom Metadata records, so you back them up with Salesforce metadata tools, not with a data export.
Back up before every upgrade, before a large configuration change, and always before uninstalling. Uninstalling Record Health Check deletes every Check Set and Check in the org, including the ones your organization created.
What to back up
Section titled “What to back up”| Custom Metadata Type | API name in your org | Contains |
|---|---|---|
| Record Health Check Set | rhc_ | Each Check Set: its object, card settings, and publication settings |
| Record Health Check | rhc_ | Each Check: its evaluation, messages, and its Check Set |
Back up both types together. Each Check refers to its Check Set by name, so a Check cannot be restored without its Check Set.
Records whose API name starts with rhc__, such as rhc__Example_Account_Check_Builder_Guide,
install with the package. Installing the package restores them, so you do not need to back them up.
Salesforce Setup has no button that downloads Custom Metadata records as a file. Use one of the two methods below, and test the restore in a sandbox before you rely on it.
Method 1: Retrieve the records with Salesforce CLI
Section titled “Method 1: Retrieve the records with Salesforce CLI”Use this method for a versioned backup that you keep in source control. You need
Salesforce CLI, a Salesforce DX project,
and an authorized connection to the org, such as my-org.
-
List the Custom Metadata records in the org:
Terminal window sf org list metadata --metadata-type CustomMetadata --target-org my-orgRecord Health Check records have full names that start with
rhc__Record_Health_Check_Set.orrhc__Record_Health_Check.. Your organization’s records have norhc__after the period, such asrhc__Record_Health_Check_Set.Account_Data_Quality. -
Create a manifest file, such as
manifest/record-health-check-backup.xml, that lists each of your organization’s records:<?xml version="1.0" encoding="UTF-8"?><Package xmlns="http://soap.sforce.com/2006/04/metadata"><types><members>rhc__Record_Health_Check_Set.Account_Data_Quality</members><members>rhc__Record_Health_Check.Billing_City_Is_Populated</members><name>CustomMetadata</name></types><version>66.0</version></Package> -
Retrieve the records:
Terminal window sf project retrieve start --manifest manifest/record-health-check-backup.xml --target-org my-orgSalesforce CLI saves one file per record in the project’s
customMetadatafolder, such asrhc__Record_Health_Check_Set.Account_Data_Quality.md-meta.xml. -
Open the files and confirm that every Check Set and Check you expect is there. Commit them to your organization’s source control.
To restore, deploy the same manifest to the target org. Check the deployment first with
--dry-run:
sf project deploy start --manifest manifest/record-health-check-backup.xml --target-org my-sandbox --dry-runsf project deploy start --manifest manifest/record-health-check-backup.xml --target-org my-sandboxThe target org must have Record Health Check installed, because the records belong to its Custom Metadata Types.
Method 2: Copy the records with a change set
Section titled “Method 2: Copy the records with a change set”Use this method to copy configuration between a sandbox and production that are connected by a deployment connection. A change set copies records between orgs; it is not a backup file, so it cannot restore records that were deleted from every org.
- In the source org, open Setup → Outbound Change Sets, and create a change set with a name that states the date and purpose.
- Under Change Set Components, select Add. Choose the component type Record Health Check Set, and add your organization’s Check Sets.
- Select Add again, choose Record Health Check, and add their Checks.
- Upload the change set to the target org.
- In the target org, open Setup → Inbound Change Sets, select Validate, and then Deploy.
Confirm the restore
Section titled “Confirm the restore”After a restore, check the target org:
| Check | Expected result |
|---|---|
| The number and names of Check Sets and Checks | Match the source. |
| Each Check’s Check Set | Names an existing Check Set. |
| Active and Evaluation Order values | Match the source. |
| Validate configuration | Reports no errors. |
| The card on a record that passes and one that fails | Shows the expected results. |
Rolling back a package upgrade
Section titled “Rolling back a package upgrade”A configuration backup does not roll back a package version, and Salesforce does not let you install an older Record Health Check version over a newer installed one. When an upgrade is not acceptable, stop the rollout in the sandbox, as described in Upgrade an installation.