If you're experiencing slow metadata comparisons using Gearset, it can be useful to reproduce this using a third-party tool such as Workbench, to diagnose whether the issue is due to the Salesforce metadata API that Gearset uses.

To compare speeds using Gearset and Workbench, you need to use Workbench to download a specific subset of metadata, and then carry out exactly the same metadata download via Gearset.

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:

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.

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>46.0</version>
</Package> 

Another example, below, could be used to retrieve Apex classes. Again, you can edit this as required. * is a wildcard that means 'all' rather than named items. (It is not possible to use * to retrieve all standard objects in the example above - they need to be individually specified by name.)

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

Retrieve via Workbench

  • 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.
  • Once logged into Workbench, click on migration, and then Retrieve
  • For Unpackaged Manifest, upload the package.xml file you created earlier.
  • 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).
  • Tick Single Package, then press Next.
  • 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.
  • Repeat the metadata retrieval several times, to determine an average speed.

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.

  • On the Compare metadata page, select the same Salesforce org to be both the source and the target of the comparison.
  • Next, open up the metadata comparison filter, and select Manage custom filters....
  • 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.)
  • 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.
  • As with Workbench, repeat the metadata retrieval several times, to determine an average speed.
Did this answer your question?