Professional Documents
Culture Documents
Environment Variables and Find & Replace Rules Cheat Sheet
Environment Variables and Find & Replace Rules Cheat Sheet
ENVIRONMENT VARIABLES
Environment Variables acts as a container that stores strings unique to a specific environment, such
as Salesforce ids, integration endpoints, or usernames. It helps to make commits, deployments, and
branch validations environment agnostic.
There are two ways to create Environment Variables in Copado and each of them serves a different
purpose as described in the module. You can create Environment Variables in:
Pipeline Record: When you create variables in the Pipeline record, you need to create them for
all the environments.
Environment Record: When you create variables in the Environment record, you do it for a
specific environment.
Keep in mind that you are putting unique names and values in each field while creating
environment variables.
SCOPE
Scope field allows you to specify where a particular variable will be applied. For instance, if you
want to use a variable in a specific metadata field, let's say Account/Level_c, you can easily do so
by putting your suggestion in the Scope field.
WHERE CAN ENVIRONMENT VARIABLES BE APPLIED?
Find & Replace Rule is one of the features in Copado that allows you to find expressions inside
the code and replace them with some other values.
Copado uses a YAML file editor which you can use to replace RegEx expressions that are
creating problems during your commits and deployment process with rules.
Note: You can also upload the already created .yml file in the editor.
IMPORTANT YAML FILE STRUCTURE
There are two important sections in the YAML file structure: regex_lib and rules.
Regex_lib: The regex_lib section contains the 'find' regex expressions. These regex expressions
are saved in a variable name so that they can be referenced in the rules section.
Rules: The rules section contains one or more rules to be executed. A rule consists of a rule
name and several rule parameters. The rule name cannot have spaces or special characters.
file_names: A list of the exact metadata file names where the find and replace will be executed.
extensions: A list of the metadata file extensions where the find and replace will be executed.
regex_name: You can specify the variable name of the regex expression that we defined in the
regex_lib section.
replace_values: A list of values to be replaced in the regex expression.
branches: The list of Git branches where the rule is applied. It will apply to all branches if left
blank.
replace_with: The value that will replace the text found by the regex expression.
Gitignore is an auto-generated file that specifies Git to ignore certain files and directories from
the repository. You can use .gitignore functionality in Global Find and Replace Rule Editor if you
want to exclude complete files from Git.