Skip to main content

Understand Prompt Templates

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain what prompt templates are.
  • Explain the benefit of adding CRM data to prompts.

What’s a Prompt Template?

Congrats! You’ve created a prompt that generates the output you want. But that was a fair bit of work. How do you scale that one prompt so that it can be used over and over again, creating output for different customers and products? The answer is, make your prompt into a prompt template.

You can think of prompt templates as basic recipes that can be adjusted to meet a customer’s unique order. As a chef, you start with the same recipe and adjust it for different occasions, to meet different dietary restrictions, and to fit different taste preferences. All you need to do is add the customer’s order details to the basic recipe and you have a new customized recipe that meets the needs of that customer.

[AI-generated image using DreamStudio at stability.ai with the prompt, “An open recipe book drawn in 2D vector art style.”]

Essentially, a prompt template is a reusable prompt. Prompt templates include placeholders for specific details about customers, products, and more. And once those placeholders are filled with real, relevant data, the prompt template becomes a truly personalized prompt. The ingredients and instructions are mostly the same, but the output is customized for your business and your target audience.

Prompt templates help your teams generate data-driven and consistent output at scale. Using prompt templates is ideal for B2C communications because templates provide both a unified voice and personalization. They also help your teams focus on completing tasks, instead of repeatedly building individual prompts. Create a prompt template once, and generate countless versions of personalized content for your different audiences.

Let’s take our prompt from earlier and turn it into a prompt template.

You are a world-renowned {role} and you have a popular blog read by millions of readers worldwide. Your readers enjoy learning about {topic} from your blog. You are writing your latest blog post. Your readers include {target audiences}. You want to captivate your readers' attention and spark their interest in learning {topic}.

You must follow the given instructions. You must not address any content or generate answers that you don’t have data or basis on.

Instructions:

Write an informative article about {subtopic}. Include a comprehensive analysis of {subjectA}. Discuss the tradeoffs and explore the challenges of {subjectB}. Include a call to action to try {product} that {description}.

Write the blog in English. The blog must be written at an 8th grade reading level and leverage adjectives to evoke imagery in the prose. Use brief, declarative sentences in an active voice. Strictly avoid using filler words, slang, and redundant language. The blog must be less than 600 words.

Now, write the blog post.

Note

Let’s put it all together. Instructions are what your team types into a generative AI app’s input field. The instructions are added to a prompt template that includes the other ingredients, such as the setting, limits, and real data. The result of that prompt template is the prompt that the LLM uses to generate output.

Prompts, the Salesforce Way

Where does the personalized data come from in your prompts? How do you turn a generic message into one that truly represents your business and connects with each of your customers?

Note

This module addresses some future functionality of Salesforce products. Any unreleased services or features referenced here are not currently available and may not be delivered on time or at all. Customers should make their purchase decisions based upon features that are currently available.

It’s all about helping the LLM take advantage of your real Salesforce data. Once you’ve created your prompt template, you connect it to your CRM data, targeting and personalizing the output. After all, an LLM is only as good as its data, so you want it to use the most relevant data there is–yours.

One way to do this is with merge fields, which we explore more in the next unit. You use merge fields to connect your prompt templates to Salesforce record fields, such as from sales or service records. When you send your prompt to the LLM, the merge fields are replaced with your specific business context and customer data.

But merge fields are just the start. As a Salesforce prompt designer, you can also use Flow Builder to create dynamic prompt fragments that go way beyond linking record fields. Flows let you add complex logic to a prompt that helps you include exactly the data you need. For example, you can use a flow like the ones in the Flow Builder Basics module to add data based on the output of a decision tree.

If this sounds powerful, you’re right. In the next unit let’s see how a Salesforce customer can combine their CRM data with instructions to create a great prompt template.

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities