Prompt Templates in Salesforce

Prompt Templates in Salesforce can streamline the development process by offering a structured approach to coding, saving valuable time and ensuring adherence to best practices.

What are Prompt Templates?

Prompt templates are reusable prompts that contain placeholders for specific details about customers, products, and other relevant data. When these placeholders are filled with real data, the prompt template becomes personalized to your business and target audience.

Why Prompt Templates?

These templates help developers save time by offering a pre-structured starting point for AI integration, thereby eliminating the need to build everything from the ground up.

The templates have been designed while keeping Salesforce’s best practices in mind, to ensure that the applications developed are robust, scalable and reliable. These templates offer developers a great deal of flexibility and customization options, enabling them to fine-tune the AI models to meet their project requirements.

Using pre-built templates can improve the user experience of Salesforce applications. These templates offer personalized and efficient services such as enhanced data analysis, predictive insights, and task automation.

This results in higher user satisfaction and productivity, while also giving developers a chance to learn more about integrating AI models and promoting innovation in their projects. The use of Einstein Prompt Templates simplifies the development process and enhances applications with the transformative power of AI.

Types of Prompt Templates:

Sales Email Template:

To streamline your email workflows, create a sales email prompt template to generate personalized and targeted emails for different customers and products. LLM can write your emails for you, which saves time and ensures consistency.

Access Prompt Builder from Setup by typing “Prompt Builder” in the Quick Find box and selecting it. Create a new prompt template and choose “Sales Email” as the Prompt Template Type.

Specify the name and description of your custom email type. This will be visible to your users in the email composer.


Prompt Templates for Developers in Salesforce
Source – Salesforce


Select a recipient to define the type of object your email is for. Additionally, you may select an object to include related data, such as Account information, in the generated email.

Prompt Templates for Developers in Salesforce
Source – Salesforce


Field Generation Templates:

Users in Salesforce can populate record fields in Lightning Experience by clicking a button to run a prompt that auto-fills the field with output.

First, navigate to Setup and search for Prompt Builder in the Quick Find box. Choose Prompt Builder from the search results. Next, click on New Prompt Template and select Field Generation from the Prompt Template Type dropdown.

Please provide the name of your Prompt Template. Then, choose an Object that contains the field you want Einstein to fill in. After that, select the specific field that you want Einstein to populate.

Lastly, add a description for your prompt template.


Prompt Templates for Developers in Salesforce
Source – Salesforce


After creating the prompt template, you will be redirected to the Prompt Template Workspace. Here, you can preview the created templates.

We need to choose a record from the available options based on the object you previously selected. Once you have chosen the record, click on “Save & Preview” to review the response from the LLM.


Prompt Templates for Developers in Salesforce
Source – Salesforce

Flex Prompt Templates:

Flex prompt templates enable you to define your resources and generate content for any business purposes that are not addressed by other templates.

In Setup Quick Find, search for the Prompt Builder. Create a new Prompt Template by clicking on “New Prompt Template”. Select “Flex” in the Prompt Template Type dropdown and enter your Prompt Template Name.

Please specify the resources that you would like to use for creating content, along with any fields or content types that you want Einstein to fill in. For each Object, please provide a unique Name and API Name.


Prompt Templates for Developers in Salesforce
Source – Salesforce


Want to Learn Salesforce Flows? Checkout our Salesforce Flow Course

To add more resources, click the “Add Resources” button located at the bottom of the resources list. You can add up to five resources.


Prompt Templates for Developers in Salesforce
Source – Salesforce


Summarize Prompt Template:

When the copilot action executes the Summarize Record standard invocable action, this action generates summaries for records using prompt templates of the Record Summary type.

The prompt template that is executed depends on the type of object the record belongs to and the prompt templates that are available to the copilot user.

It identifies the active prompt templates of type Record Summary and filters out any prompt templates that the user is not authorized to access due to license and permissions restrictions.

The following points are to be considered:

  • Only searchable and UI API-enabled records can be summarized; Data Cloud and other sources aren’t supported.
  • Users can only summarize one record at a time. They cannot filter summaries based on specific criteria, such as activities for an opportunity or case history for an account.
  • Users cannot refine a previously generated summary, which does not include news related to the account or company.

Also Read – Einstein Studio 1 in Salesforce


Developers can save time and achieve consistency across projects by using templates. These templates help ensure adherence to coding standards and allow developers to focus on delivering high-quality solutions within the Salesforce ecosystem.


1. What are prompt templates?

A prompt template helps users provide clear input to a Large Language Model(LLM) by giving them a structured framework to follow, which in turn helps the model generate accurate responses.

2. How can we integrate prompt templates into Salesforce?

Invocable Actions:

Invocable Actions provide an efficient way to automate tasks in Salesforce by creating Invocable Actions that trigger prompt template usage, streamlining repetitive processes.

Connect API:

The Connect API acts as a connection point between Salesforce and external systems, allowing for seamless integration. With Connect API, you can easily integrate prompt templates from external repositories directly into your Salesforce environment. This integration streamlines the developer’s experience by eliminating the need to switch between platforms and allowing for effortless access and the use of prompt templates.

Connect in apex:

By utilizing Connect in Apex, you can retrieve prompt templates and dynamically incorporate them into your development processes.

Metadata API:

Efficiently manage prompt templates in Salesforce using Metadata API to deploy, retrieve, and update them across multiple environments.

Get a complete Roadmap To Learn Salesforce Admin And Development

Share Now

Similar Posts

2 thoughts on “Prompt Templates in Salesforce

Leave a Reply

Your email address will not be published. Required fields are marked *