GenAiPromptTemplate

Represents the definition of a prompt template, including its related objects and fields.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

GenAiPromptTemplate components have the suffix .genAiPromptTemplate and are stored in the genAiPromptTemplates folder.

Version 

Introduced in API version 60.0.

Special Access Rules 

GenAiPromptTemplate is available only if Prompt Builder is enabled in your org and you have the Prompt Template Manager permission.

Fields 

activeVersion 

  • Type: int
  • Required: No
  • Description: This tag will be deprecated in 63.0 and will not work in 64.0 and later. Use activeVersionIdentifier instead.

activeVersionIdentifier 

  • Type: string
  • Required: No
  • Description: Specifies the version identifier of the active prompt template version. This tag will use versionIdentifier as the value for the active version.

description 

  • Type: string
  • Required: No
  • Description: A description of the prompt template.

developerName 

  • Type: string
  • Required: No
  • Description: The unique developer name of this component. Used as an API reference and must follow Salesforce identifier rules.

masterLabel 

  • Type: string
  • Required: No
  • Description: Required. A user-friendly name for GenAiPromptTemplate, which is defined when the GenAiPromptTemplate is created.

overridable 

  • Type: boolean
  • Required: No
  • Description: Indicates whether the prompt template can be overridden when part of a managed package.

overrideSource 

  • Type: string
  • Required: No

relatedEntity 

  • Type: string
  • Required: No
  • Description: The Salesforce record type that the prompt template is associated with.

relatedField 

  • Type: string
  • Required: No
  • Description: The Salesforce field that the prompt template is associated with.

templateVersions 

type 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Required. Represents the template type that the prompt template is based on.
  • Possible values:
    • einstein_gpt__fieldCompletion
    • einstein_gpt__salesEmail
    • einstein_gpt__recordSummary
    • einstein_gpt__flex
    • einstein_gpt__caseEmailDraft

visibility 

  • Type: GenAiPromptTemplateVisibilityType (enumeration of type string)
  • Required: No
  • Description: Indicates the scope of visibility for the prompt template.
  • Possible values:
    • API
    • Global

GenAiPromptTemplateDataProvider Type 

Represents a source of data for a prompt template version, such as an invocable action, flow, or Apex method.

Fields 

definition 

  • Type: string
  • Required: Yes
  • Description: Required. The URI definition of the data provider, such as flow://ns__CallToActionFlow.

description 

  • Type: string
  • Required: No
  • Description: Description of the data provider.

label 

  • Type: string
  • Required: No
  • Description: Required. A user-friendly name for GenAiPromptTemplateDataProvider, which is defined when the GenAiPromptTemplateDataProvider is created.

parameters 

referenceName 

  • Type: string
  • Required: Yes
  • Description: Required. Name of the data provider to use in expressions.

GenAiPromptTemplateDataProviderParam Type 

Represents a parameter that a data provider uses to retrieve information.

Fields 

definition 

  • Type: string
  • Required: Yes
  • Description: Required. URI definition of the parameter. For example, SOBJECT://User</definition>.

isRequired 

  • Type: boolean
  • Required: No
  • Description: Required. Specifies whether the parameter is required (true) or optional (false).

parameterName 

  • Type: string
  • Required: Yes
  • Description: Required. Name of the parameter.

valueExpression 

  • Type: string
  • Required: No
  • Description: Value or expression of the parameter to use in prompt template text. For example, {!$Input:Recipient}.

GenAiPromptTemplateGenerationConfig Type 

References the policies for this prompt template version. A policy describes high-level behavior for the prompt template, such as the allowed languages, conversation style, or desired response length. Currently, a policy is defined in a configuration file.

Fields 

generationConfigDeveloperName 

  • Type: string
  • Required: No
  • Description: Developer name of the policy for this prompt template version.

GenAiPromptTemplateInput Type 

Represents an input for a prompt template, such as a Salesforce record, field, or Apex primitive data type.

Fields 

apiName 

  • Type: string
  • Required: Yes
  • Description: Required. Name of the prompt template input parameter.

definition 

  • Type: string
  • Required: Yes
  • Description: Required. The URI definition of the input parameter. For example, SOBJECT://Account and SOBJECT://Account/Description.

description 

  • Type: string
  • Required: No
  • Description: Description of the prompt template input parameter.

masterLabel 

  • Type: string
  • Required: No
  • Description: A user-friendly name for GenAiPromptTemplateInput, which is defined when the GenAiPromptTemplateInput is created.

referenceName 

  • Type: string
  • Required: Yes
  • Description: Required. Name of the prompt template input to use in expressions. For example, Input:Recipient and Input:Sender</referenceName>.

required 

  • Type: boolean
  • Required: Yes
  • Description: Required. Specifies whether this input parameter is required (true) or optional (false).

GenAiPromptTemplateVersion Type 

Represents a version of a prompt template.

Fields 

classification 

  • Type: string
  • Required: No

content 

  • Type: string
  • Required: No
  • Description: Required. Text of the prompt template version.

defaultLanguageScope 

  • Type: string
  • Required: No

description 

  • Type: string
  • Required: No
  • Description: Description of the prompt template version.

fileDroppingStrategy 

  • Type: string
  • Required: No
  • Description: Defines the strategy for managing attached files when context limits are exceeded.

generationTemplateConfigs 

inputs 

  • Type: GenAiPromptTemplateInput[]
  • Required: No
  • Description: An array of prompt template inputs associated with the prompt template version.

isCitationEnabled 

  • Type: boolean
  • Required: No
  • Description: Indicates whether citations are included in generated responses.

keywords 

  • Type: string
  • Required: No

outputSchema 

  • Type: string
  • Required: No
  • Description: Defines the expected JSON schema structure for the generated output.

primaryModel 

  • Type: string
  • Required: No
  • Description: The model associated with the prompt template version.

responseFormat 

  • Type: GenAiPromptTemplateResponseFormat (enumeration of type string)

  • Required: No

  • Description: Defines the response format. Values are:

    • HTML
    • JSON
    • MarkDown

status 

  • Type: GenAiPromptTemplateStatus (enumeration of type string)
  • Required: No
  • Description: Required. Indicates the status of the prompt template in Prompt Builder.
  • Possible values:
    • Published — Published version of a prompt template. The active version of the prompt template must be published.

      Published prompt templates can’t be edited with UI or Metadata API.

    • Draft — Draft version of a prompt template.

templateDataProviders 

templateFormat 

  • Type: GenAIPromptTemplateFormat
  • Required: No

versionIdentifier 

  • Type: string

  • Required: No

  • Description: Version identifier of the prompt template version identifier. This is generated automatically once a template is deployed and retrieved from an org.

    If a unique value is not specified then it will be generated for you. It must be unique for each version for a given template.

versionNumber 

  • Type: int

  • Required: Yes

  • Description: Required. Version number of the prompt template version. Versions are counted sequentially from 1.

    This tag will be deprecated in 63.0 and will not work in 64.0 and later. Use versionIdentifier instead.

Declarative Metadata Sample Definition 

The following is an example of a GenAiPromptTemplate component.

1<?xml version="1.0" encoding="UTF-8"?>
2<GenAiPromptTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
3    <activeVersionIdentifier>a94ACO8feseESrBtllQUNLvKEqlCHiPSDLX5rXUnvPs=_1</activeVersionIdentifier>
4    <description>Recommend relevant financial products to client based on their needs and goals</description>
5    <masterLabel>Recommend Relevant Products</masterLabel>
6    <relatedEntity>Contact</relatedEntity>
7    <templateVersions>
8        <content>You are a financial advisor at {!$Input:Sender.CompanyName} and your name is {!$Input:Sender.Name}. You are writing an email to a prospective client recommending relevant financial products based on their data and goals. Reference the data below to generate your email, recommending only relevant products for the customer that match our recommendation criteria for each product.
9Client name: {!$Input:Recipient.Name}
10Client age: {!$Input:Recipient.Age__c}
11Client occupation: {!$Input:Recipient.Occupation__c}
12Client income: {!$Input:Recipient.Income__c}
13Client financial goals: {!$Input:Recipient.Financial_Goals__c}
14
15{!$Flow:Fetch_Products.Prompt}
16
17Generate a subject line that can increase the open rate using words and content that is related to the email body content. It must be no more than 10 words.
18Start the opening message of the email with an ice-breaker talking about relevant challenges or opportunities with personal finance and how you can help.
19Indirectly allude to a point of common interest, shared background, or relevant experience with {!$Input:Recipient.Name}. You aim to subtly reference or highlight this connection to establish rapport, demonstrate relevance, and foster a sense of familiarity.
20Indirectly encourage the lead {!$Input:Recipient.Name} to respond to your email by showing that you are willing to discuss opportunities for working together and answer any questions they may have.
21Be concise in your email.</content>
22        <inputs>
23            <apiName>Sender</apiName>
24            <definition>SOBJECT://User</definition>
25            <referenceName>Input:Sender</referenceName>
26            <required>true</required>
27        </inputs>
28        <inputs>
29            <apiName>Recipient</apiName>
30            <definition>SOBJECT://Contact</definition>
31            <referenceName>Input:Recipient</referenceName>
32            <required>true</required>
33        </inputs>
34        <primaryModel>sfdc_ai__DefaultOpenAIGPT4</primaryModel>
35        <status>Published</status>
36        <templateDataProviders>
37            <definition>flow://Fetch_Products</definition>
38            <parameters>
39                <definition>SOBJECT://User</definition>
40                <isRequired>true</isRequired>
41                <parameterName>Sender</parameterName>
42                <valueExpression>{!$Input:Sender}</valueExpression>
43            </parameters>
44            <parameters>
45                <definition>SOBJECT://Contact</definition>
46                <isRequired>true</isRequired>
47                <parameterName>Recipient</parameterName>
48                <valueExpression>{!$Input:Recipient}</valueExpression>
49            </parameters>
50            <referenceName>Flow:Fetch_Products</referenceName>
51        </templateDataProviders>
52        <versionIdentifier>a94ACO8feseESrBtllQUNLvKEqlCHiPSDLX5rXUnvPs=_1
53</versionIdentifier>
54    </templateVersions>
55    <type>einstein_gpt__salesEmail</type>
56    <visibility>Global</visibility>
57</GenAiPromptTemplate>

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>*</members>
5        <name>GenAiPromptTemplate</name>
6    </types>
7    <version>60.0</version>
8</Package>

Wildcard Support in the Manifest File 

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.