Section 5 · Testing, Deployment, and Maintenance · 10% of exam
5.4 Deploying Prompt Templates Between Environments
Exam objective
Identify the considerations for moving prompt templates from a sandbox to production, including dependencies, version status, and activation.
Treat the template as a dependency chain
A prompt template can depend on resources such as objects, fields, flows, Apex, retrievers, models, and permissions. Before deployment, list the resources the template references and make sure each exists in the target org with compatible configuration. A template that deploys successfully can still fail at runtime if a referenced flow is missing or inactive, a model configuration differs, or users lack access to required data. Salesforce provides multiple ways to move metadata, including change sets and Salesforce CLI. Follow the considerations for the method you use because behaviors are not identical across change sets, CLI, and packages.
Understand versions and activation
Prompt template versions have statuses. Activating a version publishes it, and a published version cannot be edited back into a draft. When using change sets, templates do not automatically become active in the target by default. Salesforce documents a target-org setting and permission that can enable automatic activation for change-set deployments; without it, deployed templates remain inactive and need manual activation. This setting applies to change sets, not CLI or package deployments. Plan the target activation step and ensure there is an approved active version before an agent or automation calls the template.
Check dependencies and target differences
Include dependent components and review deployment warnings. Salesforce notes that a Flow referenced by a prompt template is not automatically activated when deployed; running a template with an inactive referenced Flow can produce an error. If a custom model configuration is used, confirm the target org has a model with the matching name. Consider whether the target has the necessary feature licenses, data access, retriever, permissions, and connected resources. Do not assume the template’s source-org activation state or model availability will be reproduced automatically in production.
Test after deployment
After moving the template, inspect the target version, inputs, grounding, model selection, and activation status. Run representative prompt tests with production-like data and users. If an agent uses the template, test the full agent path as well as the template by itself, because the agent may supply different values or action outputs. Check output quality, error handling, and downstream Flow or action behavior. Document which version is active and how to restore the prior approved version if a release has problems. Deploying a template is a lifecycle event: a target-org validation is required before the dependent agent or process relies on it.
TIP: If a deployed prompt template fails, check activation, dependent Flow status, model availability, input mappings, and target-org permissions before rewriting the prompt.
Automatic template activation is a change-set-specific behavior controlled by target-org configuration; do not assume the same behavior for CLI or packages.
Extra concept: A published prompt template version is immutable. Make and test a new version when a change is needed, then deliberately activate the intended target version.
Official references:
- Change Set Considerations for Prompt Templates https://help.salesforce.com/s/articleView?id=ai.prompt_builder_considerations_changeset.htm&language=en_US&type=5
- Salesforce CLI Considerations for Prompt Templates https://help.salesforce.com/s/articleView?id=ai.prompt_builder_considerations_cli.htm&language=en_US&type=5
Key takeaways
- Track template dependencies and differences between change-set, CLI, and package deployments.
- Check target activation, referenced Flow status, model configuration, access, and data resources.
- Run prompt and end-to-end agent tests in the target org before relying on the deployed template.
