Custom metadata filters in 'Compare now (legacy)'

Guidance on how to create and save metadata filters in the older UI version of 'Compare and deploy'. Our new 2.0 version is 'Compare now'.

Jason Mann avatar
Written by Jason Mann
Updated yesterday

What are metadata filters?

Important to note: On April 4th, 2024, Gearset released a new feature called Compare 2.0. Currently, we simply refer to it as 'Compare now' because it's a new, faster, and improved way of comparing your metadata.

The new version is intended to be a more efficient way of running your comparisons than our older Compare now (legacy) feature. Currently, you can choose between the two features depending on your preference.

However, we encourage our users to familiarise with Compare 2.0. It's because Compare now (legacy) is intended to get retired at the end of May 2024, and will no longer be available.

When running a comparison between your source and target, the Gearset Default comparison filter includes the most common metadata types, including Custom objects, Profiles, Permission Sets, and Apex code.

Simply, choose your preferred filter and select Compare now to use Compare 2.0, or Compare now (legacy) to use the older version of the UI.

If you want more control over which metadata is compared, you can select a different standard filter. Or you can create your own custom filter.

As well as choosing the metadata types to retrieve, such as Apex Classes, you can also specify the names of specific items to retrieve using a custom filter. This gives you greater granularity over what to compare.

Gearset remembers your previously selected filter

For convenience, when you select a filter (standard or custom) and then run a comparison with that filter, our app will remember that filter and have it selected when you go to run a comparison again.

Custom filters are used in automation (CI) jobs

Custom filters can also be used for automation jobs, such as continuous integration (CI jobs), and org monitoring. Once you save a filter, it will be available across Gearset in any place that allows you to specify the metadata filter used.

Updating filters in automation jobs

If you edit the custom metadata filter used in a CI job, the job will not automatically use the updated filter.

To update the filter, you'll need to:

  1. On the CI dashboard click on your CI job and select Edit settings...

  2. Click on the Metadata filter tab.

  3. Click Refresh filters.

  4. Select your updated filter from the drop-down menu.

  5. Click Save.

The CI job will now apply your updated filter for all future runs.

Custom metadata filters can be shared with your team

When you save a custom metadata filter, you can choose whether to share it with the rest of your team or if you want to make the filter private (available only to you).

Who can edit filter shared with the team?

When a filter is shared with the team, only its original creator or a team owner can edit and save changes to it. Team members can use the filter but cannot make and save changes to it; they can use Save as to save any changes they make as a new named filter.

When creating a new custom filer, Before the Share with option becomes available (highlighted in grey), after you've selected all the metadata types you want to add to the filter, click on the drop-down arrow (highlighted in red), then Save as new filer, next type in your custom filter's name, and click Save as.

This will enable the Share with option and allow you to choose whether to make the filter private (by selecting Only me), or to make it available to your Team.

Custom filters (private and shared) will appear in your filter menu in the My filters section. You can find them below the all the Gearset standard filters:

Creating a custom metadata filter

  • From the Compare and deploy page in the Metadata deployments section of our app, select the Comparison filter drop-down next to the Compare now button.

  • Then select Manage custom filters...

  • In the column on the left-hand side, choose the metadata type(s) you want to include by checking the boxes next to their names. You can filter down the results using the Filter... search box at the top (highlighted in red).

    You can also select Filters > Selected only on the drop-down menu (highlighted in blue) to narrow down the preview to only the selected metadata types.

  • If you want to have more granularity over which metadata is retrieved beyond the item types, the Items to include/exclude column is the place to go. This works for the parent component level only. (For example, you cannot exclude custom fields, only custom objects.)

  • From here, you can then specify whether you want to retrieve all the items within a metadata type, or just a subset. By default, the setting will be on All items.

    You can click this slider to switch it to Named items. Be aware that if you switch the slider to Named items before you have selected your source and target orgs, there will be no items listed and the metadata type will not appear in the comparison.

    Also, note that orgs connected via username and password will not populate the named item list in the custom metadata filter (for more information see our Managing Salesforce org connections documentation).
    You can then use Refresh comparison to select your desired items from that metadata type.


  • If you selected a source and target org in the Compare and deploy screen before clicking on Manage custom filters..., Gearset will automatically list all the items in that metadata type. You can then simply select which items to include in the comparison using the checkboxes.

  • The named items in the metadata is cached for 10 minutes, and only refreshed after 10 minutes, to reduce the calls to the Salesforce org.

  • You can also use the box at the bottom of this column for filtering. For example, you can use regex to create complex item filters.

    Click on the drop-down arrow next to Object name (as shown on the above screenshot) and select Regular expression:

In the above example, we've added a regex pattern ^Appointment.* to include all the named items that begin with the word "Appointment"

  • The column on the right-hand side, Include managed packages, allows you to specify if you want to include in your filter metadata related to managed packages. In the Default comparison filter this is set to None, and in the Compare all filter this is set to All. In a custom filter you can select either of these or Choose, which will allow you to add a list of specific namespaces to include in the comparison. If you've already selected your source and target org, we'll load their namespaces and present them as suggestions for you to add to the list with one click.

  • You can also specify which metadata API version you wish to use for this filter using the setting at the bottom. By default, Gearset will automatically identify the highest commonly supported version between both of the environments you're comparing. Unless you have a specific reason to override this, we recommend leaving API version set to Default (highest common version).
    Read more about API versions on our blog post about MDAPI versioning.

Deleting a custom filter

To delete a custom filter:

  • Click Manage custom filters... and select it from the drop-down in the top left.

  • Click the red bin icon on the top right.

Standard metadata filters

Gearset app comes with seven standard or default metadata filters:

The Default comparison filter contains the most commonly compared objects. For the majority of users, this filter will retrieve all the metadata items you are interested in comparing and deploying between your environments.

To compare all supported metadata types, choose the Compare all filter. This will also include any managed packages.

The Default CI comparison filter includes the most commonly deployed components when setting up a continuous integration job in Gearset.

For detailed information about all our standard metadata filters, feel free to check this article: What is a metadata filter?

Identifying the number of metadata items in each category

When creating a custom filter to speed up comparisons, it can be useful to know which metadata types contain the largest number of items to retrieve, so that you know which types to consider excluding. 

Once you select the source and target on the Compare and deploy screen, Gearset will begin querying Salesforce for the number of metadata items to retrieve in the comparison.

Once this query completes (usually 5-10 seconds) Gearset will display the total number of metadata items.

After the query is complete, opening the Manage custom filters... dialogue will display the number of items to be retrieved in each metadata type.

For example, below you can see that there are 262 Custom objects that will be retrieved using the current filter. Using a custom filter would allow you to specify a smaller number of Custom objects if you wanted to (or if you don't need to retrieve all Custom objects found in your environment).

(Please Note: For Custom objects you can also specify sub-components, such as Custom Field or Record Type, to be retrieved along with their parent metadata which in this case is Custom object).

Note: Due to the way Gearset breaks up large objects, such as Profiles, into their constituent components, you may see a larger number of items in some categories than you expected. This is not an issue, but rather an expected behaviour.

Identifying which items to include in your custom filter

When creating a custom filter, it's important to understand the way the Salesforce metadata API works. Many objects have interlinked dependencies, and to retrieve all the metadata you're interested in, you will need to include all the relevant metadata types.

For Profiles, for example, see this support article on which metadata types you need to include in your filter to retrieve particular subcomponents:
How to retrieve Profiles and their components using Gearset's metadata filter

If you're not familiar with which metadata types you need to include in your filter, we recommend you stick with either the Default comparison or Compare all filters.

For more information, read the Salesforce documentation on the metadata API.

We are always improving here at Gearset and adding in support for new metadata types. If there is a metadata type that you are using and we don't yet support, then please contact us in our in-app chat.

Did this answer your question?