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
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
Select whether the Salesforce org is
Production
(includes developer orgs) orSandbox
, select the API version, tick the terms checkbox, and clickLogin with Salesforce
. Log in using the Salesforce org you want to investigate.Once logged into Workbench, click on
migration
, and thenRetrieve
.For
Unpackaged Manifest
, upload thepackage.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 pressNext
.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 thefileProperties
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.
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.
Hit Compare-now
This will load a blank comparison page, where you can then head to the metadata filter to specify the objects you want to retrieve.
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 theSpecify named items and rules
on your metadata object, and tick the specific items in yourpackage.xml
. Choose the API version you used in Workbench and thepackage.xml
. (For more on Gearset custom metadata filters, see this support article.)Click
Update comparison
to confirm the metadata filter and start the metadata retrieval. Start timing from when you hitUpdate 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.Once the retrieval has completed you will see this circle change to a green tick.
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: