Restore Salesforce metadata objects to minimize disruptions and ensure business operations continue smoothly. Compare metadata changes to easily deploy specific objects that have been deleted or corrupted, avoiding the cost and complexity of a full organizational restore.
To Restore Metadata
These steps are required to restore Metadata using Workbench:
- Compare metadata
- Identify metadata changes
- Download the object to restore
- Download package.xml file
- Create a ZIP file to deploy
- Deploy using Workbench
Compare Metadata
- Go to the Compare tab.
- Select the Metadata Service to compare within. You can select to compare with a different Metadata Service.
- Select the backup data and times to compare.
-
Click Compare
You are redirected to the Jobs tab.
Identify Metadata Changes
- Go to the Jobs tab.
- Select the Salesforce Metadata Compare you want to use.
-
Go to the row for the sObject that was Removed, Changed, or Added and
select the number.
A ZIP file is downloaded. If Changed is selected, the Compare Report displays.
Download package.xml File
- From the selected Salesforce Metadata Compare in the Jobs tab, click the open Metadata Service in the summary at the top of the screen.
- Go to the Backup History tab.
- Select a backup.
-
Go to the row for the sObject you're trying to restore and select the
number in the items column.
A ZIP file is downloaded. The ZIP file contains a package.xml, and a set of directories that contain the components.
The manifest file defines the components that you’re trying to retrieve or deploy in the ZIP file and the API version that’s used for the deployment.
-
Extract and open the package.xml file from the ZIP file.
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata">; <types> <members>Customer_Community</members> <name>SiteDotCom</name> </types> <types> <members>Consumer_Community_C</members> <name>SiteDotCom</name> </types> <types> <members>Social_Community_C</members> <name>SiteDotCom</name> </types> <types> <members>Legacy_Community_C</members> <name>SiteDotCom</name> </types> <types> <members>Public_Website_Kokua_C</members> <name>SiteDotCom</name> </types> <types> <members>Audiophiles_C</members> <name>SiteDotCom</name> </types> <types> <members>AudioPro_C</members> <name>SiteDotCom</name> </types> <types> <members>Mobile_Self_Service1</members> <name>SiteDotCom</name> </types> <types> <members>Partner_Community</members> <name>SiteDotCom</name> </types> <version>61.0</version> </Package> -
Delete the nodes that you're not deploying. Keep the nodes relevant to the
metadata object that you're deploying.
Your final package.xml file looks similar to this example, where you're only restoring your Customer_Community object schema metadata.
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata">; <types> <members>Customer_Community</members> <name>SiteDotCom</name> </types> <version>61.0</version> </Package> - Save your changes to the package.xml file.
Create a ZIP File to Deploy
- To deploy via Workbench, create a ZIP file of all the object folders and the package.xml file.
- Compress the extracted folders from the downloaded ZIP file including the modified package.xml file.
Deploy Using Workbench
- Navigate to the Workbench website: https://workbench.developerforce.com/
- Log-in to the Production Sandbox.
- Select Deploy from the migration tab.
-
In the Deploy screen:
- Choose File: The ZIP file you created.
- Enable Allow Missing Files.
- Enable Single Package.
-
Click Deploy
The Metadata is restored, and the results are displayed.
- After restoring your metadata, you may need to adjust the permissions in Salesforce to grant your users access to the restored components.
- As a default, when metadata is created in Salesforce it is hidden from all profiles.
- Navigate to Salesforce | Setup | Field Accessibility to make the metadata visible in the required profiles.
Restoring a Custom Object Using Workbench
You can restore a Custom Object that is deleted or corrupted. Restoration requires downloading multiple metadata components, the creation of a package.xml file, and deployment of the package via workbench.
Identify the Custom Object Metadata Modification
There are several ways to identify when the custom object modification occurred in the metadata backup.
- Go to the Dashboard tab for the Metadata Service you want to use.
- In Objects, select Custom Object and enter a date range.
- From the legend, filter out event types.
-
On the graph, select where the Object was deleted.
A detailed summary view of the backup opens.
-
Click the compare icon.
The compare screen opens.
-
Find the backup immediately before the Object was deleted and
compare.
You are redirected to the Jobs tab.
Download the Custom Objects XML File
- Create a new folder on your desktop.
- Go to the Jobs tab.
- Select the Salesforce<Metadata<Compare you want to use.
- Click the number in the Removed column to download the XML file.
-
Extract and save the Object folders to the new folder you created.
For a complete Object restore, you need the content contained in the object's objects file, and any related components stored in the separate object files. The objects XML file includes:
- Standard and Custom Fields
- Compact Layouts
- Field Sets
- Buttons
- Links
- Record Types
- Validation Rules
The XML file does not include:
- layouts (Page Layouts)
- flexipages (Lightning Page Layouts)
- quickActions (Actions)
- tabs (Tab)
- Object visibility/FLS Permissions
These missing components are contained in separate object files, which can be downloaded and included as part of your Workbench restore.
Create the Custom Objects package.xml File
Create a package.xml file and include a reference for each component to be deployed. For example, each flexipage, layout, object, quickAction, tab, and so on.
-
Create the basic package.xml:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata">; <version>61.0</version> </Package><?xml version="1.0" encoding="UTF-8"?> <Packagexmlns="http://soap.sforce.com/2006/04/metadata"><version>55.0</version></Package>; -
Add a reference for each component you want to be included in the
restore.
An individual object reference includes a header, member, name, and footer.
- The <members> tag includes the name of the component without the extension.
- The <name> tag includes the name of the metadata component.
<types> <members>Test_Lightning_Page_2</members> <name>FlexiPage</name> </types>For more information about formatting component names, see Metadata Types.
- Save your completed package.xml file to the folder you created on your desktop.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">;
<types>
<members>Test_Object_c</members>
<name>CustomObject</name>
</types>
<types>
<members>Test_Object_c</members>
<name>CustomTab</name>
<</types>
<types>
<<members>Test_Object_c-Test Object Layout</members>
<name>Layout</name>
</types>
<types>
<members>Test_Object_c-Test Layout 2</members>
<name>Layout</name><
</types>
<types>
<members>Test_Object_c-Test Layout 1</members>
<name>Layout</name>
</types>
<types>
<members>Test_Object_c.Test_Action</members>
<name>QuickAction</name>
</types>
<types>
<members>Test_Lightning_Page_2</members>
<name>FlexiPage</name>
</types>
<types>
<members>Test_Lightning_Page_Layout_1</members>
<name>FlexiPage</name>
</types>
< version>55.0</version>
</Package>
Final Steps for Object Visibility and Field-Level-Security Permissions
- When the Custom Object is deleted, all the configured permissions around Object visibility and FLS are lost. Restore Object visibility and FLS, permission by restoring the previous Profile settings.
- Run a Metadata Profile Restore job, using the most recent backup before the Object deletion against the backup taken after the Object is restored.