Example - Configure String Replacement for Agent Username
This example shows you one way to use string replacement to update the agent’s username during deployment. This method works with committed and uncommitted agents.
In this example, we:
- Specify the string to replace as
digitalagent.00dob000002dgxhf324f6b53d31@salesforce.com. - Specify that the environment variable
TARGET_AGENT_USERwill hold the new username. - Pass the new username on the command line, rather than setting the environment variable.
In the source org, find the username for the agent’s default user. The username is defined in an agent’s .agent file, in the default_agent_user property. For example:
In your Salesforce DX project’s sfdx-project.json file, configure your replacements property. Be sure to replace all instances of the agent username. In this example, we specify replacement in all metadata (*-meta.xml) and agent script (*.agent) files. We use the environment variable TARGET_AGENT_USER for string substitution. (Your project’s needs might be different).
When executing the deployment, assign the target org’s agent username to the TARGET_AGENT_USER environment variable.