All Collections
Troubleshooting
Replicating 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?

Valerio Chang avatar
Written by Valerio Chang
Updated over a week 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.

  2. Next, open up the metadata comparison filter, and select Manage custom filters....

  3. Use the checkboxes on the left to make a custom filter that matches the package.xml you uploaded to Workbench. Start by selecting and deselecting the Select all box, then tick the metadata type(s) you need. If you only retrieved specific named items of a metadata type (like in our standard object example above), change the slider from All items to Named items, 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.)

  4. Click OK to confirm the metadata filter, then COMPARE NOW to start the metadata retrieval. In the Comparison in progress screen, start timing from Logging in... and stop when the comparison window appears.

  5. 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?