Search and Substitute
  • 14 Dec 2022
  • 3 Minutes to read
  • Contributors
  • Dark
    Light

Search and Substitute

  • Dark
    Light

This article is for the Org Administrator in particular. The actions discussed in the article will not be available to general users.

Overview

The Search and Substitute rules feature allows you to define custom find and substitute rules that AutoRABIT applies whenever you commit and deploy files from one Sandbox to another Sandbox, one Sandbox to Version Control, or vice-versa.

Procedure

  1. Login to your AutoRABIT account. 
  2. Hover your mouse over the Admin module and click on the Search and Substitute option.
  3. Click on Create Rule. A rule consists of a rule label and several rule parameters.

Rules Parameters

1. Metadata Type

Until now, Search and Substitute only had the ability to select a metadata type and then perform the search for substrings across all members in that type. But now, you can select specific metadata members in a type and substitute values for that member(s).

Use Cases: 

  • If you have a custom label in one of your orgs whose values are the same across multiple labels, but you only want to change one of those values, then the ability to search for a specific label and then apply substitution rules will help. 
  • Suppose you need to add a few object permissions only to a Production environment and not to the lower sandboxes. In that case, you will now be able to do so instead of having to manually comment out some metadata in the Permission Set file during sandbox deployments and then uncomment them before a Production deployment. 
  • The rules can be created and used in CI Jobs to do the replacements automatically depending on the deployment settings in the CI Job. 
Supported Metadata Types
Below is an updated list of all the metadata types which are compatible with the enhanced Search and Substitute functionality.
  • AutoResponseRule
  • CustomLabel
  • CustomMetadata
  • CustomObject
  • CustomSite
  • Dashboard
  • DashboardFolderShare
  • Network
  • NamedCredential
  • PermissionSet
  • Portal
  • Queue
  • RemoteSiteSettings
  • Report
  • ReportFolderShare
  • SamlSsoConfig
  • SharingCriteriaRule
  • SharingOwnerRule
  • Workflow

2. Sub Element

The element in which you want to substitute the character.

3. Criteria

The text you want to replace.

4. Substitute

The value that will replace the text.

To substitute multiple values, click on the '+' icon and add the field parameters again. However, you can add the utmost of 5 parameters for a rule, beyond which the application won’t allow you to do so. Also, make sure the parameters are not duplicated, which may result in the failure of search and substitute functionality.

Example:

In the following example, the 'Formatchange' rule will be applied to the 'CustomObject' metadata type. The sub-element is 'Fields.displayFormat' and the values to be replaced is 'a-{000}'. The value to replace this with is 'a-{001}'.

Once you're done creating the rule, click on the Save button.

The rule will get displayed in the Search and Substitute home screen with an option to either edit the rule, delete it or create a new rule using the existing rules using the clone icon.
 

What's Next?

You have successfully created a new rule. The next step is to specify the newly created rule whenever you perform a CI, deployment, or commit operation in AutoRABIT.

Deploying the changes to a Sandbox with new rule assigned

While deploying the changes from one Sandbox to another Sandbox, you can apply the Search and Substitute rule in the 'Deployment Settings' screen. 

From the 'Apply Search and Substitute Rules' list, select the rule that will be associated with the current deployment process. Use the / button to add/remove the rule and using the / button, move the rules list up and down. Based on the selection, the top rule will be deployed in the beginning and the process continues for the remaining rules.

Committing the changes from one Salesforce org to a Version Control branch with new rule assigned

While committing the metadata components changes to a Version Control Branch, you can apply the Search and Substitute rule in the Commit or Submit for Validation screen. Refer to the Commit topic for the detailed commit process.

Performing CI Job with new rule assigned

While committing the metadata components changes to a Salesforce Org to a Version Control Branch using CI Job, you can apply the Search and Substitute rule in the Create CI Job screen under the 'Deploy' section.


Was this article helpful?

What's Next