Adding regex patterns to object-level metadata filters

Ellis Toms on

Share with


Every deployment in Gearset starts with a comparison between two environments, whether they’re Salesforce organisations or metadata stored in a git repo. Being able to compare the metadata between two environments has lots of advantages, one of the most important being the ability to quickly get an overview of all the ways in which they differ, and selectively deploy changes.

That said, we’ve all had the dubious pleasure of working with environments that have diverged more significantly than we’d like, whether it’s due to teams working on features for the same org, a sandbox that hasn’t been refreshed in a long while or inheriting less-than-perfect legacy orgs. This can result in comparisons between orgs with thousands of differences, making it difficult to discern the changes you’re interested in deploying. It can also result in longer comparison times, as all of that metadata needs to be retrieved from Salesforce before it can be compared.

We want to make configuring your comparisons and deployments as fast and easy as possible. So to help mitigate this problem, we’ve expanded on the ways you pick which metadata Gearset compares for you. Until today, the granularity of Gearset’s filtering was limited to either a whole metadata type, e.g. CustomObject, or specific named items within that type, e.g. Account. With the latest release, we’ve added the ability for users to add regex patterns to object-level filters and the option to specify items that they want to exclude from the comparison, speeding up deployment configuration and making it easier to ensure you’re only seeing the metadata you’re interested in.

Adding regex patterns to your custom filters

Under Metadata comparison filter click Manage custom filters…. Like before, you can create a custom object-level filter by selecting a metadata type from the left-hand list, and switching the toggle from All items to Named items.

After clicking a metadata type to include, switch the toggle to Named items.

At this point you now have a few options for how you select the components you’d like to include within your filter; and subsequent comparison. You can either use the checkboxes to pick specific items, or you can add a regex pattern to quickly grab and include all the metadata items you’re interested in.

For example, say you want your filter to include all items that begin with Site. Rather than manually selecting every object, you can add a rule to automatically include those matching items. To add this rule, use the dropdown to change the selection from Object name to Regular expression. Type the regex pattern ^Site.* into the adjacent field, click Add to save your new rule and that’s it!

Type in your regex pattern and click Add to save your new rule.

Excluding specific items

If you wanted to exclude any items from your regex rule, like SitePoweredBy in this case, switch back from Regular expression to Object name, select Exclude from the dropdown on the right, type ‘SitePoweredBy’ in the text field and click Add.

Switch to Exclude in the dropdown and type in the name of the object you'd like to omit.

If you want to remove any regex patterns or exclusions you can just click the cross symbol on the right. Or, if you want to switch them off, just deselect the checkbox.

Improve your deployment speed

Make sure you’re only including the metadata that’s relevant to your current project and team with regex patterns, and see how much faster it makes configuring your deployments. If you’re already a Gearset customer why not try it out - and if you haven’t put us through your paces yet, start your free 30-day trial today!

Try all of Gearset for free