Skip to main content
All CollectionsTroubleshootingReplicating issues
How to replicate metadata download speeds with Workbench
How to replicate metadata download speeds with Workbench

Part 3 of 3 of Workbench series - why do comparisons take a lot of time?

Vincent Maltby avatar
Written by Vincent Maltby
Updated over 4 months ago

Is your metadata comparison retrieval in Gearset slow? Is it stuck in downloading metadata for ages even for a few metadata items?


The most common reason is that the Salesforce Metadata API that Gearset uses is being slow to respond. To rule out this reason you can use Workbench to download a specific subset of metadata, and see how long that takes.

Step 1: retrieve specific metadata using Workbench

Create package.xml file

Firstly, choose a specific subset of metadata to test. You will need to create a package.xml manifest file to upload to Workbench. For more detailed, general information on package.xml manifest files, see this Salesforce article.

Here is an example you can use to retrieve an Apex class named TestClass :

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>TestClass</members>
<name>ApexClass</name>
</types>
<version>58.0</version>
</Package>

If you want a more detailed example

For standard objects, you need to specify them by name. For example, for the standard objects Account, Case, Contact, Lead, Opportunity, Order, Task and User, your package.xml file could be as follows. You can edit the text to add or remove standard objects as required, or to change the API version. (Note that standard objects are referred to as custom objects in the metadata API.)

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Account</members>
<members>Case</members>
<members>Contact</members>
<members>Lead</members>
<members>Opportunity</members>
<members>Order</members>
<members>Task</members>
<members>User</members>
<name>CustomObject</name>
</types>
<version>58.0</version>
</Package>

Retrieve via Workbench

  1. Select whether the Salesforce org is Production (includes developer orgs) or Sandbox, select the API version, tick the terms checkbox, and click Login with Salesforce. Log in using the Salesforce org you want to investigate.

  2. Once logged into Workbench, click on migration, and then Retrieve

  3. For Unpackaged Manifest, upload the package.xml file you created earlier.

  4. The Package Names field can be left blank (unless you want to retrieve metadata items that are part of managed packages; in which case, provide a comma-separated list of package names).

  5. Tick Single Package, then press Next.

  6. On the next page, click the Retrieve button to start the metadata download from Salesforce via the metadata API. Time how long it takes Workbench to show you the results. You can open the fileProperties folder to check that Workbench has retrieved the metadata items you requested.

This allows you to establish a baseline of how long the API retrieval took.

Step 2: retrieve the same specific metadata using Gearset

Once you have retrieved the metadata via Workbench, try retrieving the exact same metadata from the same org using Gearset.

  1. On the Compare metadata page, select the same Salesforce org to be both the source and the target of the comparison and select the On-demand comparison metadata filter.

  2. Hit Compare-now

  3. This will load a blank comparison page, where you can then head to the metadata filter to specify the objects you want to retrieve.

  4. Use the checkboxes on the left to make a custom filter that matches the package.xml you uploaded to Workbench. If you only retrieved specific named items of a metadata type (like in our standard object example above), select the Specify named items and rules on your metadata object, and tick the specific items in your package.xml. Choose the API version you used in Workbench and the package.xml. (For more on Gearset custom metadata filters, see this support article.)

  5. Click Update comparison to confirm the metadata filter and start the metadata retrieval. Start timing from when you hit Update comparison and stop when all objects have been loaded. You can see the progress of the retrieval in the top left of the comparison screen.

  6. Once the retrieval has completed you will see this circle change to a green tick.

  7. As with Workbench, repeat the metadata retrieval several times, to determine an average speed.

Salesforce Workbench

Workbench is a simple web tool that's popularly used to access an org's metadata. You use your Salesforce login details - you don't need to create a separate account.

Like Gearset, Workbench communicates with Salesforce orgs via the Salesforce metadata API. This makes it an ideal tool to debug issues such as slow metadata retrieval.

For more on Workbench, see our related support articles:

Did this answer your question?