Skip to main content

Connect Your Flows to Einstein Copilot

Learning Objectives

In this project, you’ll:

  • Test Copilot actions with sample data in Copilot Builder.
  • Create a custom Copilot action to use Flow for automation.

Bring Einstein Copilot into the Conversation

Generative AI has made it possible to interact with computers in the same way we interact with our friends and coworkers: with conversational language. Einstein Copilot adds this amazing power of generative AI into Salesforce so you can interact with Salesforce conversationally, too. Using everyday language, you can ask Einstein Copilot to get the latest hot leads, summarize a case, or draft an email to a potential customer.

As you learn in Einstein Copilot Basics, Copilot actions and custom actions are the building-blocks for these natural interactions. For example, one action, called Query Records, finds and retrieves Salesforce records based on the user’s request and specific conditions. Einstein Copilot comes with several actions out of the box, and together they allow for some really sophisticated interactions. Custom actions allow you to create actions that are unique to your organization, and they can even harness Flow and Apex for truly impressive interactions.

In this project you explore the standard Copilot actions, and learn how to test them in the Copilot Builder. Then you create a custom action that uses an existing flow that we’ve already set up to initiate a return for a recent order.

Sign Up for a Trial Org with Einstein Generative AI

To complete this project, you need a special trial org that has Einstein Copilot 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: Prompt Builder badge, and you still have an active org, you can use it to complete this project. Just skip down to the Get to Know Copilot Actions 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 could 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.
  1. You are now logged in to your special trial org.
Note

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.

Get to Know Copilot Actions

Einstein Copilot is already quite capable out of the box thanks to the premade actions that you just learned about. Let’s take a minute to review those actions in Copilot Builder, and discover what Einstein Copilot can do without any customization on your part.

  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. From the App Launcher, search for orders then click Orders.
    App Launcher with Orders highlighted.
  3. Choose the All Orders list view.
    Two orders will appear, both for Edge Communications. They play a role later in our story, so it’s good to verify they exist. Now we can set up Copilot.
  4. Click Setup icon and click Setup. The Setup page opens in a new tab.
  5. In the Quick Find box, enter einstein setup, then click Einstein Setup.
  6. Turn on Einstein by clicking the toggle. It may already be on if you’ve completed the Quick Start: Prompt Builder project.
    Einstein setup page.
  7. Refresh your browser window. This reveals new admin settings now that Einstein is enabled.
  8. In the Quick Find box, enter copilot, then click Einstein Copilots.
    Currently, you can customize and launch one copilot for your employees, and that copilot is available in the flow of work in Salesforce.
  9. Turn on Einstein Copilot for Salesforce by clicking the toggle.
    Einstein Copilot setup page.
  10. Click Einstein Copilot, found at the bottom of the page.
  11. Click Open in Builder.
    Open in Builder button.
  12. If the right-hand pane has a welcome message, click Got It.

Welcome to the Copilot Builder. Here you can test your copilot and witness how it plans its response using real data.

Conversation Preview pane in Copilot Builder.

It’s okay if you see an error message in the Conversation Preview, the following directions will work. Let’s start a conversation by asking your copilot what it can do.

  1. In the Conversation Preview window, type What can you do? Then press return.
    Einstein Copilot begins processing your question. It’s figuring out what you intend, and how to respond. In a moment you’ll get an answer that’s based on the available Copilot actions. Einstein Copilot uses large language models (LLMs) so you might find some questions return results that are a bit different that the screen captures in this project.
    If you get a message that Copilot is having trouble, then click the Reset icon Reset conversation button in the Conversation Preview window and try again. You’ll notice that your copilot can search and retrieve records. Let’s give that a try.
  2. In the Conversation Preview window, type Tell me about the account Edge Communications. Then press return.

A lot happens when you ask this question. And in Copilot Builder you see the process your copilot follows in order to respond, shown as a Dynamic Plan.

Dynamic Planner displaying two sequential Copilot actions.

For this request, your copilot recognized that two actions were required. First, it needed to identify the correct account. Second, it needed to summarize the details. The ability to chain together the right actions is one of the ways that makes Einstein Copilot especially good at maintaining its side of the conversation. Another important part of holding a conversation is remembering details that were brought up earlier. Copilot can do that too! For example, you can ask it to provide more details about something it previously mentioned.

  1. In the Conversation Preview window Do they have any active orders? Then press return.

This time Einstein Copilot uses the context of the conversation to understand that you are asking about orders specific to Edge Communications. After a moment, details of the two existing orders will appear.

Create a Custom Copilot Action

The standard Copilot actions can do a lot, but in this scenario you have a special process for handling order returns. In fact, you already have a flow that automates the process. (Team Trailhead made the flow for you in your Einstein AI-enabled org.)

You can use that flow to extend the capabilities of your copilot. You do that by creating a custom action that references the flow.

  1. Click the left arrow Back button to setup to exit Copilot Builder.
  2. In the Quick Find box, enter copilot, then click Einstein Copilot Actions.
  3. Click New Copilot Action.
  4. For Reference Action Type, choose Flow.
  5. For Reference Action, choose Initiate Return.
    This is the existing flow you’ve been using to initiate order returns.
  6. Click Next.
  7. For Copilot Action Instructions, paste the following:
    Use Initiate Return for requests to return or refund orders or products in an order.
  8. For Instructions (under Inputs), paste the following:
    Populate this input variable with an Order recordId.
  9. Check Require Input.
  10. Check Collect data from user.
  11. For Instructions (under Outputs), paste the following:
    This output indicates the status of the return request, whether it has been initiated, processed, or completed.
  12. Check Show in conversation.
  13. Click Finish.

Excellent, your custom copilot action has everything it needs. For this example, we supplied the descriptions because they are critical to how the action will function. They are used as part of the prompt that Einstein AI sends to the LLM. You can learn all about what makes a great prompt in the Prompt Fundamentals badge. Then use the prompt engineering skills you learn to make the descriptions for your custom copilot actions clear and complete.

Now you have to go back to the Copilot Builder to add the new action to your copilot.

  1. Click Einstein Copilots.
  2. Click Einstein Copilot.
  3. Click Open in Builder.
  4. Click Deactivate, then click OK.
    Your copilot must be deactivated in order to add new actions.
  5. Click Copilot Action Library.
    Copilot actions pane.
  6. In the menu for Initiate Return, choose Assigned to Active Copilot.
    Action menu with Assign to Copilot visible.
  7. Click Activate.

Great, your copilot can now use the Initiate Return action in a conversation. Let’s try it out as if we were an actual user.

  1. Close the Setup tab to return to the Sales app.
  2. Click the Home tab.
    Let’s start from Home as if we were just starting our day.
  3. Refresh your browser window, which should make the Einstein button appear.
  4. Click the Einstein button to open the conversation window.
    Toolbar with Einstein button.
  5. In the conversation window, type What actions can you do? Then press return.
    Copilot has added the functionality of the new action into the summary of what it can do. To start your test, give your copilot some context to work with by finding a specific order.
  6. In the conversation window, type What is the order with the most recent start date? Then press return.
    After a moment it should display order 101, with a clickable link.
  7. Click order number 00000101.
  8. In the conversation window, type Tell me about order 101. Then press return.
    The summary will describe three products, the same order products in the related list. Edge Communications accidentally ordered these items, so let’s start a return.
  9. In the conversation window, type Start a return for order 101. Then press return.
    Because your custom action has a clear and comprehensive description, your copilot can identify it as the action you intend to take. So it will kick off the related flow, and give you a status update.
  10. Click the Details tab.

If you scroll to the bottom of the page, you’ll find that the Return Status field has been updated to Initiated thanks to the Initiate Return flow.

With just a few clicks, you can incorporate existing automation into your copilot’s catalog of actions. Now, automations and processes that are unique to your organization can be part of the conversation when interacting with Einstein AI.

Resources

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