How Do Environment Variables Work?

Let's suppose you have the deployment flow below and you want a value in Dev1 to be replaced automatically when deploying to UAT and production, for instance the custom label value (this will also work with other components).

The custom label value in UAT that will replace the value of Dev1.

The value in UAT should be replaced with https://UATfakeurl.html.

You can set the environment variable like this:

Commit the Account Summary custom label in a user story.

The value https://Dev1fakeurl.html in Dev1 is replaced with the {!Environment.ACCOUNT_SUMMARY} key in the feature branch.

User-added image

When promoting the user story, the {!Environment.ACCOUNT_SUMMARY} key in the feature branch is merged into the promotion branch, and it will be replaced with the value https://UATfakeurl.html when deploying to UAT.

This is the result after deploying:


In the Deployment record, you can see that there is a replacement.

How did we do?