During Salesforce deployments, you may find yourself needing to change certain metadata values so that they suit the target org. Finding and changing these values manually before or after you deploy can be a major headache. Now, Gearset helps you automatically change these specific values in your XML as you deploy.
Salesforce teams frequently need to replace metadata values during deployments. For example, maybe you have notifications set to go to different email addresses depending on whether you’re in a UAT or production environment. Or maybe you have an external webhook URL that should change between orgs.
Imagine you have a different set of dev IP ranges permitted for different orgs. When you want to deploy changes to the relevant metadata, you don’t want to carry over the difference in IP ranges. Previously, you might have manually modified the metadata via Git before deploying, but this can now be done without leaving Gearset at all!
How Gearset handles environment variables
The example pictured below shows how Gearset will automatically find and replace instances of the first IP address in the specified metadata with the second, so that the IP range for the source and target environments remain correct. Gearset can do this for all metadata types, including Apex Classes, custom metadata types, Lightning Web Components and Aura components.
You can have as many variables as you like per target, and once they’re set up, they will automatically be applied to all manual and CI deployments and validations that include the items specified in the variables.
Set up environment variables in Gearset
To configure environment variables, head to the My Account page in Gearset and select the Environment variables tab. Then choose a target connection to create variables for and hit Add Target. All target types can have environment variables, including Git-based providers. At this point, no replacements are being made in the target. The next stage is to set up individual values to find and replace during deployments.
As you can see in the image below, each target connection has a table of environment variables that will be applied to deployments featuring the specified metadata type and item. Gearset looks for instances of the ‘Find what’ value and changes it to the ‘Replace with’ value. Note that this functionality can’t be used to edit XML tags, only the values within them.
Your feedback shapes our roadmap
At Gearset, we use customer-oriented research to drive product improvements, and our work on environment variables is a good example of this in action.
We noticed that many customers would carry out extra steps after a deployment, changing certain values in metadata XML to suit a the target environment. Customers with tedious pre- or post-deployment steps wanted a way to automate them, and some suggested an environment variable system. Looking at the feedback on our Uservoice forum, we also noticed that many requests for inline editing of XML reflected use cases where teams would benefit from a system to replace values during deployments.
We decided to reach out to more users via the live chat, and spoke to hundreds of customers to research different use cases for an environment variables feature. This helped us zero in on which issues we could solve with the most wide-reaching and quick improvement to user experience.
Once the first cut of the feature was out, we launched the pilot and started getting feedback, which guided the direction of the next slice. This iteration process continued, with the feature becoming more well-rounded each time.
Let us know what you think!
We’re always looking to make further improvements, so please do get in touch with us via the live chat if you have any questions or comments. And if you’re new to Gearset, start a free trial to try out environment variables and see how Gearset can make your release process smoother!