Restoring a field in Salesforce can refer to two main scenarios: recovering a deleted field definition (metadata) or restoring the data contained within a field (its values) on records. Understanding which type of restoration you need is crucial for the correct approach.
1. Restoring a Deleted Field Definition (Metadata)
If a custom field was accidentally deleted, it can often be recovered from the Salesforce Recycle Bin, much like a deleted record. This restores the field's metadata, making it available for use again.
How to Restore a Deleted Custom Field:
- Access the Recycle Bin:
- From Salesforce Setup, in the Quick Find box, type
Recycle Bin
and then select Recycle Bin. - Alternatively, from the App Launcher, search for and select Recycle Bin.
- From Salesforce Setup, in the Quick Find box, type
- Find the Deleted Field:
- The Recycle Bin displays both deleted records and deleted metadata components. Look for the custom field you wish to restore. You might need to filter or sort by "Type" to easily locate custom fields.
- Restore the Field:
- Select the checkbox next to the deleted custom field(s).
- Click the Restore button.
Once restored, the field will reappear on its associated object and page layouts. Any data that was in the field before deletion will also be restored.
Important Considerations for Deleted Fields:
- Retention Period: Deleted custom fields remain in the Recycle Bin for 15 days, or until the Recycle Bin is emptied, whichever comes first. After this period, they are permanently deleted (hard deleted) and cannot be recovered via the Recycle Bin.
- Dependencies: If the deleted field had dependencies (e.g., was part of a workflow rule, formula, or Apex code), these dependencies might need to be re-established or reviewed after restoration.
- Standard Fields: Standard fields in Salesforce cannot be deleted, only hidden or removed from page layouts. Therefore, they cannot be "restored" in the same way.
2. Restoring Field Data (Values) or Entire Records
If a field's value was accidentally changed, a record was deleted, or an entire object's data was corrupted, you would need to restore the data. This typically involves using a data backup and recovery solution or, for specific cases, Salesforce's native tools.
Using Data Protection Solutions for Record-Level Restore:
Many data protection solutions provide robust capabilities for restoring Salesforce data, including individual field values, specific records, or even entire objects, from a backup. This is often the most comprehensive way to recover from data loss or corruption.
Here's a general approach using such a solution:
- Navigate to the Data Protection Interface: Access your data protection solution's dedicated portal or application, often found through a specific navigation pane or dashboard.
- Select Your Salesforce Organization: Within the solution, locate the "Organizations" or "Instances" tab and choose the specific Salesforce organization that contains the data you want to restore.
- Initiate a Restore Operation: For the selected organization, click the action button or menu, typically labeled with options like "Restore" or "Recover."
- Choose Record Level Restore: To restore specific data, select the "Record level restore" option. This allows for granular recovery of individual records or field values.
- Identify the Object and Data: From the list of available objects, select the specific object (e.g., Account, Contact, Custom_Object__c) that contains the field data you need to restore. You will then typically be guided to select the specific records and even fields within those records to restore from a chosen backup point in time.
This process ensures that the correct field values are brought back without affecting other data.
Native Salesforce Data Restoration Options:
While Salesforce doesn't offer a direct "undo" button for data changes, you have several options for restoring field data:
- Manual Re-entry: For a small number of records with known correct values, simply edit the records and manually re-enter the correct data.
- Data Loader: If you have an export of your data from before the change, you can use the Salesforce Data Loader (or other data import tools) to update the affected records with the correct field values. This requires careful preparation of your CSV file to match record IDs.
- Steps for Data Loader:
- Export the affected records before the data change (if possible, or from an older backup).
- Prepare a CSV file with the correct field values and the record IDs.
- Use Data Loader to perform an "Update" operation, mapping the ID field and the fields you wish to restore.
- Steps for Data Loader:
- Salesforce Backup & Restore (Managed Package): Salesforce offers a managed package solution called "Backup & Restore" which allows administrators to schedule daily backups and restore data at the object or record level. This provides a native way to recover data without relying on external tools.
- Key Features: Automated daily backups, point-in-time restore, granular object and record recovery.
- Reporting and History Tracking:
- Field History Tracking: If enabled for a specific field, you can view its change history directly on the record's related list. This helps identify when and by whom a field value was changed, aiding in manual correction.
- Reports: Running reports on objects before data changes can help you identify the correct values to restore.
Comparison of Restoration Methods
Method | Description | Use Case | Pros | Cons |
---|---|---|---|---|
Recycle Bin | Recovers deleted custom field definitions (metadata). | Accidental deletion of a custom field. | Simple, native, retains existing data after recovery. | Only for custom fields, 15-day limit, metadata only. |
Data Protection Solution | Restores field data, records, or objects from backups. | Accidental data modification, record deletion, mass data corruption. | Granular, point-in-time recovery, comprehensive. | Requires a separate solution, setup and configuration time. |
Salesforce Data Loader / API | Updates specific field values or records from a CSV file. | Correcting known data errors on multiple records where old data is available. | Flexible, powerful for mass updates, uses native API. | Requires data preparation, technical knowledge, no "undo" button. |
Salesforce Backup & Restore | Managed package for automated daily backups and data restoration. | Regular data protection, native Salesforce-provided recovery. | Native, automated, easy to use for recovery. | Requires installation and configuration, might have storage limits. |
Manual Re-entry | Manually editing a record to correct a field value. | Isolated data entry errors on a few records. | Simple, immediate. | Time-consuming for many records, prone to human error. |
Best Practices for Data Protection
To minimize the need for complex field or data restoration, consider these proactive measures:
- Implement a robust backup strategy: Use a reliable third-party data protection solution or Salesforce Backup & Restore for regular, automated backups.
- Enable Field History Tracking: For critical fields, enable history tracking to monitor changes over time, helping to identify and correct data errors.
- Regularly export data: Schedule periodic data exports (e.g., weekly or monthly) using Salesforce's Data Export Service as an additional safety net.
- Use Sandbox environments: Always test significant data operations, integrations, or metadata changes in a Sandbox environment before deploying to production.
- Grant permissions judiciously: Restrict modify all data or delete permissions to only those users who absolutely need them.
- Train users: Educate users on data entry best practices and the impact of deleting records or changing critical field values.
By combining native Salesforce features with effective data protection strategies, you can ensure that your critical Salesforce fields and their data are well-protected and easily restorable.