The Ultimate Salesforce Prompt Builder Cheat Sheet

The Ultimate Salesforce Prompt Builder Cheat Sheet

In a world increasingly driven by artificial intelligence, the ability to craft precise prompts isn’t just a nice-to-have—it’s essential. This cheat sheet will empower you to harness the full potential of Salesforce Prompt Builder, transforming the way you work.

What you’ll gain from this cheat sheet:

  • Essential Prompting Skills: Learn how to create prompts that guide AI to deliver the results you need.
  • Master Salesforce Prompt Builder: Understand its key features and how to integrate it seamlessly into your workflows.
  • Design Effective Prompt Templates: Discover how to build and customize templates for various business scenarios.
  • Best Practices: Get actionable tips to maximize the accuracy and relevance of your AI-generated content.

Let’s get started!

What is a Prompt?

A prompt is essentially a set of instructions provided to a large language model (LLM) to generate desired content. Whether it’s drafting an email, summarizing a meeting, or brainstorming ideas, prompts act as guides to shape the output produced by the AI. The quality of the LLM’s output depends heavily on how well the prompt is constructed.  

AD 4nXff q2h4F36eNNAACWrpNONH2eWBnrP3pM7xnN3JZdS MpWSuibzsmyc05TYaSGJEixq2C4Xee

Key Considerations:

  • Participants: Define who is involved, both as the creator and the recipient of the output. This adds clarity and ensures the generated content speaks directly to the intended audience.
  • Context: Providing the AI with specific context or background information makes the output more personalized and accurate.
  • Objective: Be clear about what you want to achieve. For example, are you trying to inform, persuade, or entertain? The clearer the goal, the more tailored the output will be.
  • Limitations: Constraints such as word count, style, tone, or even specific topics to avoid, help keep the content focused and within defined boundaries.

 Key Limitations:

  • Vague Instructions: A poorly structured or unclear prompt will often result in irrelevant or generic responses.
  • Inconsistent Output: LLMs can sometimes produce different results even with the same prompt due to their non-deterministic nature. Adjusting certain settings like temperature can help control this variability.
  • Lack of Grounding: Without grounding in real, relevant data (such as customer or product details), the AI’s output may contain generic or incorrect information.

Use Case:

A real estate firm needs to automate the process of sending personalized follow-up emails to clients after property viewings.

Solution: Email Summary Prompt

Reason for the Solution: The real estate firm created a detailed prompt template that draws on CRM data, such as the client’s name, property details, and viewing feedback. By grounding the prompt with this data, the LLM generates personalized follow-up emails summarizing the viewing experience and outlining the next steps. 

This saves time for agents and ensures timely, professional communication with clients.

Also Read – Salesforce Einstein Copilot – The Ultimate Guide

What is Prompt Builder?

Prompt Builder is a versatile tool within Salesforce that allows you to integrate generative AI into user workflows by creating, testing, and managing prompt templates. 

These templates use CRM data, merge fields, flows, and Apex to generate AI-driven outputs that help automate tasks like drafting emails, summarizing conversations, and updating fields. By embedding generative AI into daily workflows, Prompt Builder enhances productivity and personalizes customer interactions.

Key Features:

  • Prompt Templates: Create and manage reusable templates for automating AI-driven responses based on Salesforce data. Templates can be customized for use cases such as drafting emails, generating summaries, and more.
  • Grounding with CRM Data: Incorporate Salesforce data into prompts to ensure personalized and context-relevant responses, leveraging data from record fields, flows, related lists, and Apex.
  • Prompt Design and Testing: Use a dedicated workspace to design, test, and refine prompts to ensure high-quality AI outputs tailored to your use case.
  • Dynamic Flow Integration: Use Flow Builder to add conditional logic, making prompts adaptable to different scenarios and ensuring responses are more accurate and relevant.
  • Data Masking and Security: The Einstein Trust Layer ensures that sensitive data is masked and securely handled, replacing it with placeholder text in the prompts sent to the LLM (large language model).
  • Multiple Prompt Template Types: Tailor templates to specific needs, like Sales Emails or Field Generation, ensuring efficient use of generative AI across workflows.

Key Considerations:

  • Prompt Design: The quality of AI responses depends on how well prompts are designed. Iterating and testing prompt templates is key to ensuring they produce relevant, accurate results.
  • Grounding: Always ground prompts with CRM data to provide context, reducing the likelihood of generating irrelevant or inaccurate responses.
  • Security and Data Masking: Ensure sensitive data is properly masked using the Einstein Trust Layer to protect customer information while interacting with the LLM.

Email Generation

Prompt Builder supports the creation of templates that automatically generate personalized emails, streamlining tasks such as lead outreach or event invitations. By integrating CRM data, businesses can ensure emails are targeted and relevant, saving time while maintaining a high degree of customization.

Field Generation

Field generation brings AI-driven content directly into Salesforce fields on desktop or mobile, allowing for real-time updates like generating summaries or product descriptions. This feature can streamline workflows, improve productivity, and empower teams to access up-to-date information instantly.

 With Prompt Builder, your business can scale the creation of intelligent, data-driven prompts that simplify tasks, enhance productivity, and ensure more meaningful customer engagements.

getgenerativeai

Designing Effective Prompts

Creating an effective prompt involves combining key ingredients with clear, detailed instructions to guide the LLM (Large Language Model) in generating relevant and high-quality content. Just like a recipe, prompts need specific components to ensure the output aligns with your goals.

Key Ingredients for Prompts:

  • Participants: Identify who is involved in the task or communication.
  • Setting: Provide context to help the model understand the background of the request.
  • Goal: Clearly outline what outcome you want the model to achieve.
  • Relationships: Define how the participants interact and how the content connects with them.
  • Data: Supply any relevant information or details the model will need to include.

After gathering these components, you should provide specific instructions to the LLM on what kind of content to generate and the constraints it must follow.

Adding Constraints:

  • Limits: Set boundaries to avoid irrelevant or incorrect information.
  • Language: Specify the language or style the content should follow.
  • Style & Tone: Define how the content should be written, including tone, reading level, or word count limits.

By carefully designing your prompts with these ingredients and constraints, you can ensure more accurate and personalized output that aligns with your specific business or project needs.

 Example Scenario: 

You want to draft a promotional email for a new product launch targeting potential customers in the technology sector.

Prompt: “You are a marketing professional at a tech company. You are writing an email to promote our new software product aimed at improving productivity for technology companies. Your audience includes CTOs, IT managers, and tech consultants who are looking for solutions to streamline their operations.

Provide an informative email introducing the product, outlining its key features, and highlighting how it can reduce operational costs by 20%. Make sure to include a call to action that invites the recipient to schedule a demo.

The email should be written in English, at a professional level, and should not exceed 300 words. Avoid technical jargon, but maintain a formal tone. The call to action should be clear and motivating, encouraging recipients to take the next step.”

By including participants, the setting, a clear goal, and specific constraints, this prompt provides the LLM with the necessary information to generate a relevant and effective email.

Also Read – The Ultimate Salesforce Einstein AI Cheat Sheet

What’s a Prompt Template?

A prompt template is a reusable framework for generating prompts that can be personalized with specific data, such as customer details or product information. 

Think of it as a basic recipe that can be adapted for different needs. Just like a chef modifies a standard recipe to meet unique preferences or dietary requirements, prompt templates allow you to adjust a single prompt to fit the needs of various customers and use cases.

Scaling with Salesforce Data

The real power of prompt templates in Salesforce comes when you connect them with your CRM data. By using tools like merge fields and Flow Builder, you can ensure the templates pull live, relevant data from your Salesforce records. This allows the LLM to generate responses grounded in actual customer data, making the output even more personalized and accurate.

Through this integration, your teams can quickly generate consistent, high-quality prompts that meet both the needs of your business and the preferences of your customers, all without having to build individual prompts from scratch each time.

Key Benefits:

  • Scalability: Create once, use repeatedly with personalized data for various customers or products.
  • Efficiency: Saves time by eliminating the need to create new prompts for every task.
  • Consistency: Ensures a unified voice while maintaining personalization.
  • Data-Driven: Leverages Salesforce data to create relevant and accurate content.

 Key Considerations:

  • Understand Your Audience: Define who is involved and their relationship to the content.
  • Set Clear Goals: Ensure the LLM knows the specific objective of the prompt.
  • Provide Context: Specify the setting, tone, and style for the generated output.
  • Establish Limits: Set constraints like word limits and avoid content outside the scope.
  • Test and Refine: Continuously test and adjust your prompt templates for accurate, consistent results.

 Types of Prompt Templates

  • Pilot Templates: Available only to users who participated in the Prompt Builder pilot program. These templates cannot be used directly but can serve as reference material.
  • Custom Templates: Created from scratch by users using the New Prompt Template button. These templates offer full flexibility to meet specific business needs.
  • Standard Templates: Pre-made templates accessible to all users. They are pre-configured for common use cases across different prompt types, such as sales emails and record summaries.

Prompt Template Types

In Prompt Builder, various prompt template types are designed to help streamline and automate specific tasks by leveraging Salesforce data. These templates allow users to generate personalized content, summaries, and prioritizations, making workflows more efficient. Here’s a breakdown of the types:

  1. Field Generation: Generates AI-created content to populate record fields in Lightning Experience. Users trigger this prompt by clicking a button within Salesforce, and it automatically fills in the required data.
  2. Flex: A versatile template designed for business use cases that are not covered by other types. Flex templates allow customization based on unique business needs.
  3. Sales Emails: Creates personalized customer emails based on data from Salesforce records, helping sales teams save time while maintaining personalization.
  4. Record Prioritization: Helps prioritize records based on user inputs or data. Commonly used for prioritizing sales opportunities within Einstein Copilot.
  5. Record Summary: Summarizes record data, providing a comprehensive overview. It’s used within the Summarize Record action to give users a quick snapshot of essential details.

These templates empower teams to create tailored content and workflows that increase productivity and accuracy.

Prompt Review Lifecycle

The prompt review lifecycle ensures that your generative AI templates deliver effective and relevant outputs. With the iterative process, prompt templates can be tested, revised, and improved to meet specific business needs. 

This process involves reviewing the generated responses, evaluating their quality, resolving the prompts with real CRM data, and making necessary adjustments until the outputs align with desired expectations. The lifecycle promotes continual improvement of prompt templates for accuracy and relevance in output generation.

  1. Preview a Generated Response: In the Prompt Preview section of the workspace, users can review a response grounded with real Salesforce data.
  2. Evaluate Response Quality: Assess if the generated response meets the intended goals, is factually accurate, and doesn’t include harmful or biased content.
  3. Enable Resolution for Review: Through prompt resolution, each merge field in the prompt template is replaced with real CRM data. This resolved prompt helps review and revise the prompt.
  4. Revise the Prompt Template: Refining the prompt template is an iterative process. Users regenerate resolved prompts and responses, then make further updates based on new outputs. It’s vital to review all outputs, as the same prompt may generate different responses each time.
  5. View Harmful Content Notifications: If a response contains harmful content (such as abusive, hateful, or toxic language), the Prompt Builder will notify the user with a “Harmful Content” badge, requiring prompt revision to eliminate any inappropriate content.

Key Considerations:

  • Prompt responses can vary even with the same prompt due to LLM nuances.
  • Regularly evaluate prompts for accuracy and adjust for consistent results.
  • Merge fields should accurately reflect real data for personalized responses.
  • Previous outputs are not saved when the prompt is regenerated.
  • Prompt templates require multiple revisions to consistently produce optimal results.
  • Responses may contain harmful content, which should be addressed by revising the prompt.

Create and Manage Prompt Template

Creating a prompt template in Salesforce enables you to automate and streamline workflows involving large language models (LLMs). By defining prompt templates, you provide detailed instructions to the model, guiding it to generate relevant and personalized responses based on Salesforce CRM data. 

This process includes selecting a template type, defining the resources, and crafting the necessary instructions.

Key Considerations:

  • Template Type Selection: Choose the correct prompt template type (e.g., Sales Emails, Field Generation) based on your specific business use case.
  • Resource Definition: Ensure that the relevant CRM data fields, flows, and custom resources are properly included for accurate LLM responses.
  • Reusability: Build the template with scalability in mind, allowing it to be used across multiple workflows while still being adaptable for unique cases.
  • User Permissions: Only users with the Prompt Template Manager permission set can create and manage prompt templates.
  • Template Dependencies: The effectiveness of the template depends on the availability of relevant CRM data, which must be accurate and up to date.

Activate and Deactivate Prompt Templates

Activating and deactivating prompt templates allows you to control which version of a template is available to users. This process ensures that only finalized and tested versions are accessible. When a prompt template is activated, it becomes available for use, but only one version can be active at a time. If no versions are active, the template is unavailable to users. 

To modify an activated version, you must save it as a new version. You can deactivate any active template at any time to restrict access to that version.

Also Read – Top Salesforce AI Tools – The Ultimate List

Use Multiple Versions of a Prompt Template

Prompt Builder allows you to create and compare multiple versions of a prompt template to refine its structure and improve responses. Each version can be saved and tested individually, enabling you to tweak grounding data, LLM settings, or template wording to achieve the desired output. Once a version is saved, it is assigned a version number, which is reflected in the Prompt Template Workspace. 

When multiple versions exist, you can use a dropdown menu to select and compare them. Each version remains immutable once activated, meaning it cannot be changed, but you can save it as a new version or a completely new template.

Changing LLM Configurations

In Prompt Builder, you can easily modify or select a new LLM configuration to customize how outputs are generated. By default, Prompt Builder includes several pre-configured standard LLM configurations, but users also have the option to bring their own LLM (BYO-LLM) for specific use cases. Modifications to standard configurations are saved as custom versions.

Each version of a prompt template can have a unique LLM configuration. However, only the configuration in the currently active template version will be applied. If changes are needed after activation, the version must be saved as a new version to remain editable.

Sales Email Prompt Template

A Sales Email Prompt Template is a customizable framework designed to generate personalized, data-driven email content at scale using Salesforce CRM data. By leveraging Salesforce’s records and merge fields, these templates automatically create tailored emails for contacts or leads, streamlining communication and saving time.

Dynamic Content for Sales Email Templates Options 

  1. Record Merge Fields : Record merge fields pull specific data from Salesforce records directly into your email template. This allows for easy personalization by using fields such as recipient name, title, or company. The placeholders are replaced with actual record data when the email is generated.
  2. Flow Merge Fields Without Data Cloud Objects: Flow merge fields allow you to use Salesforce Flow to dynamically retrieve and insert data into your email template. These fields are ideal for automating emails based on real-time data, such as upcoming events or special promotions relevant to the recipient’s location.
  3. Flow Merge Fields with Data Cloud Objects Flow merge fields with Data Cloud objects go a step further by using data consolidated from multiple sources in Data Cloud. This enables you to access unified customer profiles, offering a more up-to-date and complete view of each contact’s details.
  4. Apex Merge Fields Apex merge fields allow you to run custom Apex code within your email template. This provides the flexibility to pull highly specific data from complex queries or external systems, making your email content even more personalized and dynamic.

By using these dynamic content options, Sales Email Prompt Templates can generate more effective and personalized communication at scale, ensuring that your team stays connected with customers while saving valuable time and effort.

Field Generation Prompt Template

A Field Generation Prompt Template integrates generative AI workflows directly into Salesforce record pages, allowing users to auto-populate specific fields, such as summaries or descriptions, with AI-generated content. This can help streamline interactions and ensure that users have the most relevant, up-to-date data for efficient customer interactions.

Dynamic Content for Field Generation Templates Options

  1. Record Merge Fields: Record merge fields pull specific data from Salesforce objects, allowing the template to create AI-generated content based on up-to-the-minute information stored in your Salesforce records. These fields make your templates dynamic and personalized.
  2. Flow Merge Fields Without Data Cloud Objects: These merge fields allow you to integrate Salesforce Flows into your field generation templates without needing Data Cloud objects. This is ideal for summarizing data, such as open cases for an account, and displaying them in relevant fields automatically.
  3. Flow Merge Fields with Data Cloud Objects: Flow merge fields with Data Cloud objects provide a 360-degree view by leveraging unified customer data consolidated across multiple sources. This allows AI-generated fields to be populated with more comprehensive and real-time insights from Data Cloud.
  4. Apex Merge Fields: Apex merge fields allow you to run custom Apex code for complex queries or data extraction, enabling dynamic field content generation based on unique business logic. This provides advanced flexibility for data retrieval and display in Salesforce fields.
  5.  Retriever (Einstein Search) Merge Fields Summary: Retrievers utilize Einstein Search to pull data from external sources or unstructured data, such as Wikipedia, to generate insights or summaries directly in Salesforce fields. This is useful for bringing in relevant external data into Salesforce workflows.

Flex Prompt Template

A Flex Prompt Template allows you to craft AI-generated content for any business use case not covered by other template types. These templates provide flexibility, allowing you to define resources, such as Salesforce records, flows, and custom inputs, to generate tailored content for various business cases, such as personalized emails, product descriptions, or custom text messages.

 Dynamic Content for Flex Prompt Templates Options

  1. Record Merge Fields: Record merge fields pull data directly from Salesforce objects, enabling AI-generated content to be dynamic and specific to each record. This allows for personalized content, such as custom text messages or detailed product descriptions, based on up-to-date data.
  2. Flow Merge Fields Without Data Cloud Objects: These merge fields integrate Salesforce Flows into Flex templates, pulling together data from various Salesforce sources. This allows you to generate dynamic content based on data compiled from flows, such as product records or service campaigns.
  3.  Flow Merge Fields with Data Cloud Objects: Flow merge fields with Data Cloud objects provide a comprehensive view of your customers by using unified data from multiple sources. This allows for generating content based on more accurate, consolidated data from across systems.
  4. Apex Merge Fields: Apex merge fields enable advanced customization by integrating custom Apex code into Flex templates. This allows the AI to generate content based on more complex or specific data queries that are processed through Apex logic.
  5. Free Text Inputs: Free text inputs allow users to input arbitrary text that the AI can use when generating content. This flexibility is useful in scenarios where users might want to include additional data, such as customer queries or feedback, into the content generation process.

Best Practices for Building Prompt Templates

When creating prompt templates, there are several best practices to keep in mind to ensure clarity, consistency, and effectiveness.

  1. Keep it concise: Use clear, natural language without industry jargon or overly technical terms.
  2. Use role-play: Instruct the LLM to act as a specific character, like a sales or support representative, and define the character’s goal. Example: “You are a marketing executive inviting customers to a live event.”
  3. Iterate on templates: Test different versions of prompt templates and gather end-user feedback to improve effectiveness.
  4. Maintain a consistent style: Use the same writing style, word choices, and punctuation across templates to ensure consistent LLM responses.
  5. Separate instructions clearly: Create an Instructions: section and enclose instructions in triple quotes (“””) to help the LLM differentiate between context and the task.
  6. Provide direct instructions: Tell the LLM exactly what to generate. For example, “Follow these instructions strictly to generate only the email message.”
  7. Leverage template libraries: Start with templates from an Example Prompt Template Library and customize them to fit your specific needs, studying the language used for writing style and tone.

Prompt Builder Limitations

Prompt Builder has several numerical and functional limitations that affect template size, merge fields, and specific functionalities within Salesforce. Understanding these limits ensures that templates remain efficient and manageable.

Functional Limitations

  • Audit Trail: Creating or updating prompt templates isn’t tracked in the Setup Audit Trail.
  • New Custom Objects/Fields: Newly created custom objects or fields aren’t immediately available in Prompt Builder. Log out and back in to use them.
  • Record Selection: Templates with encrypted or missing name fields cannot be previewed.
  • Supported Object Types: Supports standard objects, custom objects (__c), and related lists (__r). KnowledgeArticleVersion objects are only supported for Flex templates.

 Template-Specific Limitations

  • Field Generation Templates: Cannot be used for rich text areas in knowledge entities (__kav). Use Flex templates, Flow, or Apex instead.
  • Flex Templates: Cannot import or export metadata, such as Apex classes or flows. Remove any flows or Apex resources before deleting the template.
  • Einstein Search: Change sets do not include Einstein Search retriever metadata. Retrievers must be manually created in the destination org before deployment.

Ground Prompt Templates with Salesforce Resources

Prompt Builder allows you to use CRM data dynamically within prompt templates through the use of merge fields. This technique, known as grounding, gives the LLM (Large Language Model) the necessary context to deliver tailored, accurate responses using the latest Salesforce information. With the Einstein Trust Layer, sensitive data, like personal information, remains secure within Salesforce and is not shared externally with the LLM.

How Grounding Works

 When setting up a prompt template, you first select an object to associate with your template.

  • For field generation templates, you can choose a specific field for Einstein to help complete.
  • You can then add merge fields referencing record fields, flows, Apex classes, Data Cloud DMOs, or related lists.

Ground with Record Merge Fields

 Record merge fields allow prompt templates to access Salesforce object fields, connecting your templates to real-time data for personalized output. These merge fields are determined by the prompt template type and the objects you associate with it, ensuring relevant and dynamic responses.

How Record Merge Fields Work

  1. Sales Email Prompt Templates: Merge fields can pull data from the recipient (contact or lead), sender (user), and sender’s organization.
  2. Field Generation Prompt Templates: These templates use merge fields related to the current user, their organization, and the object linked to the template.
  3. Flex Prompt Templates: Flex templates can reference data from the current user, their organization, and the objects tied to the template.

 Ground with Flow Merge Fields

Flow merge fields allow you to enhance your prompt templates by incorporating complex logic and real-time data through Salesforce Flow Builder. By integrating flows, you can create more dynamic templates that pull data from multiple sources, including unified Data Cloud objects, providing real-time insights to improve your AI-generated content.

How Flow Merge Fields Work 

  • Flows in Prompt Templates: You can use flows to dynamically generate content in your prompt templates by launching a flow when the prompt template is triggered. The flow fetches data, processes it, and returns specific information as part of the template output.
  • Data Cloud Integration: Flows enable you to access unified Data Cloud objects, consolidating data from multiple sources. This makes it possible to use real-time, comprehensive data in your prompts, ensuring that the generated content is up-to-date and relevant. 

Steps to Use Flow Merge Fields 

  1. Create a Flow: Use Template-Triggered Prompt Flow in Flow Builder to create flows specifically designed for prompt templates. This type of flow adds dynamic instructions to the associated template.
  2. Use the Get Records Element: To pull Data Cloud information, use the “Get Records” element in the flow and select “Data Cloud Object” as the data source. Apply filters to retrieve the relevant data.
  3. Add Prompt Instructions: Use Create Prompt Instructions elements to define what the flow should return to the prompt template. These instructions can include CRM and Data Cloud data through merge fields, such as Input.Contact.MailingCity, which could return values like “San Francisco.”
  4. Link the Flow to the Template: Add the flow to your template by referencing it in the format Flow:FlowName. When the prompt template runs, the flow is executed, and the prompt instructions are added as dynamic content in the output. 

Ground with Apex Merge Fields

Apex merge fields allow you to enhance your prompt templates by returning data from SOQL queries or external APIs, enabling dynamic, real-time data integration. You can also use Apex for tasks such as generating well-structured JSON or applying custom programmatic filtering.

Key Requirements for Using Apex in Prompt Templates

  • Apex Class with InvocableMethod: The class must contain a method annotated with @InvocableMethod. This annotation links the class to the specific prompt template type through the CapabilityType attribute.
  • CapabilityType Assignment: Each prompt template type has its own unique CapabilityType. For example:
    • Sales Email: PromptTemplateType://einstein_gpt__salesEmail
    • Field Generation: PromptTemplateType://einstein_gpt__fieldCompletion
    • Flex: FlexTemplate://template_API_Name
  • Method Input: The input parameter must use a List<Request> type. This Request class defines InvocableVariable members, which correspond to the template’s inputs, such as an Account object. The CapabilityType acts as an interface for the Request class, ensuring the input fields match the object and variables defined in the prompt template.
  • Method Output: The output is a List<Response> type containing a single string variable named Prompt. This output is used to pass the result of the Apex logic back to the prompt template as a string.

Discover more helpful Salesforce cheat sheets by visiting our Salesforce Cheat Sheets page.

End Note

By mastering the art of prompt engineering with Salesforce Prompt Builder, you’re equipping yourself with a skill that’s increasingly vital in today’s AI-driven landscape. This cheat sheet has provided you with the tools to enhance productivity and create more personalized customer interactions.

Elevate your Salesforce consulting services with GetGenerative.ai. Effortlessly craft exceptional proposals, giving you more time to focus on delivering outstanding service to your clients.

Start your journey today!