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.
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:
- How to use Workbench to check which metadata items can be retrieved over the Salesforce metadata API
- How to use Workbench to replicate deployment errors
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"?>
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"?>
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
Unpackaged Manifest, upload the
package.xmlfile you created earlier.
Package Namesfield 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).
Single Package, then press
- On the next page, click the
Retrievebutton 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
filePropertiesfolder 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.xmlyou uploaded to Workbench. Start by selecting and deselecting the
Select allbox, 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
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.)
OKto confirm the metadata filter, then
COMPARE NOWto start the metadata retrieval. In the
Comparison in progressscreen, 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.