Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Agentforce and Einstein Generative AI
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Salesforce CLI Considerations for Prompt Templates

          Salesforce CLI Considerations for Prompt Templates

          Understand the limits and behaviors that are related to metadata component dependencies and deployment when using Salesforce CLI with Prompt Templates.

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Performance, and Unlimited Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations

          What Is Salesforce CLI?

          Salesforce CLI is a command-line interface that simplifies development and build automation when working with your Salesforce org. You can use it to synchronize metadata between your org and a local DX project stored in a source repository such as GitHub.

          To download Salesforce CLI, click here. See the Salesforce CLI Setup Guide for detailed documentation.

          Use Salesforce CLI with Prompt Templates

          Prompt templates are represented in an org with the GenAiPromptTemplate metadata type. Use standard Salesforce CLI commands to deploy and retrieve specific GenAiPromptTemplate components between your DX project and org.

          Deploy:

          sf project deploy start --metadata GenAiPromptTemplate:TemplateName --target-org myorg@username.com

          Retrieve:

          sf project retrieve start --metadata GenAiPromptTemplate:TemplateName --target-org myorg@username.com
          

          Replace TemplateName with the name of your prompt template, and myorg@username.com with the unique username or alias of your org.

          For more information about the project commands, and other CLI commands you can use, see Salesforce CLI Command Reference.

          Activate and Deactivate Prompt Templates

          • You can use <versionIdentifier> in <activeVersionIdentifier> to activate a template, or you can activate a template in the UI and retrieve it for correct XML.
          • If a template is in use, block deactivation of a version unless another version is activated.
          • If a prompt template version is published and not in use, any version can be activated or deactivated.
          • If a template isn't in use, version deactivation is allowed without needing to activate another version.

          Create New Prompt Templates

          • After adding a new template, get the template because <versionIdentifier> is generated automatically after the version is created.
          • When you have a template with <versionIdentifier> and <activeVersionIdentifier>, you can deploy that to another org. The versionIdentifier ensures that there's no need for you to deploy or retrieve it for all orgs in CI/CD pipelines.

          Delete Prompt Templates

          • Prompt templates can't be deleted via CLI.
          • Prompt template versions can be deleted with the CLI. When deleted, it's ‌removed from the version in XML.
          • A template version can be deleted from the XML and deployed via CLI. The deleted version is deleted in the target org unless that version is active and in use.
          • If a template is used with an active version, it can’t be deleted.

          Deploy Prompt Templates

          • You must have at least 1 template version to deploy the template.

          Deploy Only the Active Template Version

          A setting in Setup, under Einstein, controls whether only the active prompt template version is deployed via CLI. This setting is disabled by default.

          When this setting is enabled, the deployment follows these rules.

          • Only the active version of each template is deployed to the target org. All inactive versions are silently skipped.
          • If a template has no active version, the deployment fails with an error.
          • Existing versions in the target org are never deleted. Deployment is append-only.
          • If the active version already exists in the target org, these conditions apply.
            • If the version is in draft status, the content is updated and the version is activated.
            • If the version is published, the content isn't modified (published versions are immutable). Only the activation status changes.
          • If the active version doesn't exist in the target org, a new version is created and activated.
          • If the template doesn't exist in the target org, a new template is created with only the active version.
          • This setting doesn't apply to managed package scenarios.

          When this setting is disabled, the default behavior applies.

          • All versions are deployed as they are today. No change in behavior.

          Modify Prompt Templates

          • If a prompt template version is published and not in use, it can’t be modified.
          • Any published version can't be modified. The deploy will succeeds, and published versions are skipped.
          • If you manually set <versionIdentifier> and have duplicated it, the new and old versions will overwrite each other, if those versions are in draft status. Otherwise, the first published version stays and the second one is skipped, as published versions are immutable.

          Other Considerations

          • If a template has been overridden, users aren't allowed to override it again with a changeset, CLI, or Connect API.
           
          Loading
          Salesforce Help | Article