Skip to main content

Get Started with Prompt Builder

Learning Objectives

In this project, you’ll:

  • Create and test a prompt template that includes merge fields.
  • Associate a prompt template with a text field for field generation.

Streamline Content Generation

Prompt Builder gives your organization an easy way to tap into the power of generative AI. It helps you combine existing data with some well-crafted instructions to create prompt templates. In a nutshell, prompt templates are used to create prompts, the messages sent to large language models (LLMs) in order to generate content.

Prompt templates are special because they include placeholders for specific details about customers, products, cases, and more. Each time a prompt template is used, it merges the data to create a unique, personalized prompt, which results in a personalized response. And since prompt templates are reusable, they’re a key part of a scalable AI implementation. For a more in-depth explanation of prompts and prompt templates, check out Prompt Fundamentals.

In this project you get hands-on by creating a prompt template, and then use it to get actual generated responses from an LLM. Specifically, you’ll focus on a scenario everyone is familiar with: customer support cases. In an effort to boost productivity and customer satisfaction, you want to use generative AI to summarize the details of a case in about 100 words. This enables agents to get up to speed quickly and makes it easier to identify cases that deserve special attention.

Screenshot of a case with a populated Quick Summary field.

Sign Up for a Trial Org with Einstein Generative AI

To complete this project, you need a special trial org that has Einstein Generative AI enabled and our sample data. The trial org is only available for a limited 5-day period—so be sure to complete this project before your org expires.

If you just completed the Quick Start: Einstein Copilot badge and you still have an active org, you can use it to complete this project. Just skip down to the Create a Field Generation Prompt Template section. If not, take these steps.

  1. Sign up for a free, 5-day trial org with Einstein Generative AI.
  2. Fill out the form. Enter an active email address where you can receive the email confirmation of the new account.
  3. After filling out the form, click Sign Me Up. A confirmation message appears.
  4. An email with the subject line “Finish resetting your Salesforce password” from support@salesforce.com is sent once your org has been created (this can take a few minutes).
    • Identify and save your username (1).
    • Click the link (2) to reset your password.
      Reset password image with callouts on username and the link that needs to be clicked to reset.
  5. You are now logged in to your special trial org.
Note

This limited, 5-day trial org is designed to work with the challenges in this badge, and may not work for other badges. Always check that you’re using the Trailhead Playground or special org that we recommend.

Connect Your Trial Org to Trailhead

  1. Make sure you’re logged in to your Trailhead account.
  2. In the Challenge section at the bottom of this page, click the org name and then click Connect Org.
  3. On the login screen, enter the username and password for the trial org you just set up. Note: If you receive an error message, refresh your browser.
  4. On the Allow Access? screen, click Allow.
  5. On the “Want to connect this org for hands-on challenges?” screen, click Yes! Save it. You are redirected to the challenge page and ready to use your new trial org to earn this badge.

Create a Field Generation Prompt Template

In this project, you want a case summary to appear in a text field on the record. To save a little time, Team Trailhead has already created a field named Quick Summary and placed it into the page layout. At this point there’s nothing special about it, but let’s change that! You start by creating a prompt template.

  1. If you don’t already have your Einstein AI-enabled trial org open, scroll down to the Challenge section and click Launch to open it.
  2. Click Setup icon and click Setup. The Setup page opens in a new tab.
  3. In the Quick Find box, enter einstein setup, then click Einstein Setup.
  4. Turn on Einstein by clicking the toggle. It may already be on if you’ve completed the Quick Start: Einstein Copilot project.
    Einstein setup page.
  5. Refresh your browser window. This reveals new admin settings now that Einstein is enabled.
  6. In the Quick Find box, enter prompt, then click Prompt Builder.
  7. Click New Prompt Template.
    New Prompt Template buttonFor this example you use the Field Generation type of prompt template, so leave that as is.
  8. For Prompt Template Name, enter Quick Summary.
  9. For API Name, enter Quick_Summary.
  10. For Template Description, enter A short summary of case details.
  11. For Object, find and select Case.
  12. For Object Field, find and select Quick Summary.
  13. Click Next.

Great, you now have the start of a prompt template. It’s time to build it by writing some clear instructions that describe what you want from the LLM. As you learn in the Prompt Fundamentals badge, there are several things you can add to get better results. In this example you include direction for the overall goal, size limits, and some guardrails.

Writing a good prompt is somewhat of an art form, so for this project we give you a prompt that we know works well.

  1. Paste the following text into the Prompt Template Workspace.
    Summarize the concatenation of the contents of the comment bodies of COMMENTS along with the text from SUBJECT, the case priority which is PRIORITY, and the case type which is TYPE.
    Keep the response to a single short paragraph.
  2. For Models, choose OpenAI GPT 4.
    Model selection in Template Properties.There are several models to choose from in your Einstein AI-enabled org, and OpenAI GPT 4 produces some great results.

This sample text includes a few placeholders in all caps for things like case priority. Let’s replace those with actual merge fields so the LLM can create a custom tailored response for a variety of situations.

  1. Place the mouse cursor in front of PRIORITY.
  2. Click in the Resource box to open the list of resources.
    Expanded list of resources.
  3. Click Case, then click Priority.
    A merge field is inserted into text as blue text.
  4. Delete PRIORITY to leave behind just the merge field.

It’s just that easy to ground your prompt in real data. There are a few more placeholders to replace, so repeat the above steps to insert the following merge fields. If you use the Search box, make sure to first click Case, then type the field name. Finally, when you add in case comments, you’ll notice the brown color indicates that it’s a related list.

Placeholder

Case Merge Field

COMMENTS

CaseComments

SUBJECT

Subject

TYPE

Case Type

With merge fields in place, your prompt template should look like this.

Prompt Builder window with completed contents.

Now that your prompt template includes merge fields and good instructions, it’s time to test it out. Prompt Builder makes it easy to try your prompt template with actual data. All you need is a sample record to draw from.

  1. In the Related Record box, find and select case 00001002.
    Related record input box.
  2. Click Save & Preview.
  3. Click Activate.

This is the moment you’ve been waiting for! Your instructions have been sent to the LLM, and in response you get a generated summary of the case in just a few sentences. Yours may appear a little different than the screen captures in this project. That’s OK, it’s normal for LLMs to respond to the same prompt in more than one way.

Enable Dynamic Forms for Cases

Your prompt template is ready to go. The last step is to update the page layout so that your customer support team can use the new prompt template.

  1. While still on the Prompt Builder page, verify that you’ve clicked Activate.
  2. Close the Setup tab to return to the Sales app.
  3. In the Navigation Bar, click Cases. (You may need to click More to find it.)
  4. Click the down arrow next to Recently Viewed, and select All Open Cases.
  5. Click case number 00001002.
  6. Click Setup icon and click Edit Page.
  7. Select the contents of the Details section [1].
    Details section selected with Record Detail opened.
  8. With the Details section selected, click Upgrade Now in the Record Detail to upgrade to Dynamic Forms.
  9. Click Next.
  10. Select the Case Layout radio button.
  11. Click Finish.
  12. In the Details section, click the Quick Summary field.
  13. For Prompt Template, find and select Quick Summary.
    Screenshot of Prompt Template selection box.
  14. Click Save and then Activate.
  15. Click the Assign as Org Default button.
  16. Click Next and then Save.
  17. Click the back arrow in the upper left to leave the Lightning App Builder.

Excellent, the Quick Summary field is ready to use Einstein Generative AI. You can tell because the edit button has a little star next to it.

Screenshot of a field with updated icon.

Let’s try it out.

  1. Click Edit icon on the Quick Summary field.
  2. Click Get help with Einstein icon on the right of the field. This automatically opens up the Einstein overlay, using your prompt template to start a new conversation. In a moment Einstein will suggest a case summary. Again, yours may appear a little different than ours.Einstein overlay with a suggested case summary.This gives your users a chance to review the summary, and even continue the conversation with Einstein to work together on a revised version. For this example, you just accept the first suggestion. There should be a Use button in the Einstein overlay. If there isn’t, just refresh the page and do steps 1 & 2 again.
  3. Click Use.
  4. Click the X to close the Einstein overlay.
    Notice that the Quick Summary field is filled in.
  5. Click Save.

With just a few clicks, your users can access the power of Einstein Generative AI to quickly create useful content so that they can focus on more important things. The conversational nature of Einstein lets them refine the generated content in real time, and they can always tweak it after it’s placed into the field.

Great job creating such a helpful prompt template. Have fun experimenting in the Prompt Builder to discover other ways to automate text generation for your organization.

Resources

¡Siga aprendiendo gratis!
Regístrese para obtener una cuenta y continuar.
¿Qué hay para usted?
  • Consiga recomendaciones personalizadas para sus objetivos profesionales
  • Practique sus aptitudes con retos prácticos y pruebas
  • Siga y comparta su progreso con empleadores
  • Póngase en contacto para recibir asesoramiento y oportunidades laborales