Skip to main content

Find and Replace Environmental Variables

This feature is designed for deployments with environmental variables that need to be hard coded before deploying.

T
Written by Tam Tran
Updated over 3 years ago

Find and Replace rules allow you to transform the source metadata before deploying them to the target org. Some of the examples where Find & Replace rules can be used:

  • You wish to ignore specific user permissions related to profiles that might cause deployments to fail.

  • You wish to replace all the IP ranges with the values specific to the target Org

  • You wish to remove manage package components from your deployments.

Adding Find & Replace Rules

In the deployment details page, select the "Deployment Options" tab, then expand the "advanced options" and you will see the text area to enter Find & Replace rules as the screenshot below.

Screen_Shot_2019-07-02_at_10.18.00_AM.png

Rules Format

Find & Replace rules should be in YAML format. The syntax is as simple as the sample below:

rule1_update_iprange:
file_filters:
- '*Admin*.profile'
- '*Sales*.profile'
replace_rules:
- find: '192.168.1.1'
replace: '0.0.0.0'
- find: '192.168.1.255'
replace: '255.255.255.255'
rule2_remove_user_permissions:
file_filters:
- '*.profile'
replace_rules:
- find: '(?s)\s*(.*?)'
replace: ''
rule3_remove_category_group_visibilities:
file_filters:
- '*.profile'
replace_rules:
- find : '(?s)\s*(.*?)'
replace : ''

Did this answer your question?