Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create a Sales Email Template-Triggered Prompt Flow Example

          Create a Sales Email Template-Triggered Prompt Flow Example

          This example creates a flow that integrates with a sales email prompt template to automatically gather and present relevant events for your contacts.

          Required Editions

          Available in: Lightning Experience
          View supported editions.
          This feature requires the Einstein for Sales, Einstein for Service, or Einstein Platform add-on. To purchase, contact your Salesforce account executive.
          User Permissions Needed
          To open, edit, create, activate or deactivate a flow using all flow types, elements, and features available in Flow Builder, including Einstein and Agentforce for Flow: Manage Flow
          To create and manage prompt templates in Prompt Builder: Prompt Template Manager permission set

          Template-triggered prompt flows aren't compatible with prompt templates created in Winter '24.

          Let's say you're a Salesforce admin, and your sales team requests an easier way to send emails to contacts about nearby Marketing events. You create an email prompt template that launches a prompt template flow to get Marketing events in the same city and state as your contact. And you draft an email for contacts about nearby Marketing events. We use a flow to get a list of events and their locations for the LLM.

          Before creating your sales email prompt template, you create a flow that retrieves a list of events. For this example, you create the Get Marketing Events flow.

          1. Turn on Einstein.
            1. From Setup, in the Quick Find box, enter Einstein Setup, and then click Einstein Setup.
            2. Turn on Einstein.
          2. Open the Flows list view.
            • From Setup, in the Quick Find box, enter Flows, and then select Flows.
            • From the Automation app, select the Flows tab.
            • From the Flows tab in any Lightning app, click the actions menu and select Open Flow.
          3. Create the flow.
            • From the Automation app, click New | Autolaunched | Template-Triggered Prompt Flow.
            • From Setup, click New Flow | Autolaunched | Template-Triggered Prompt Flow.
          4. Configure the flow.
            1. Select Automatic Inputs.
            2. For Prompt Template Type, select Sales Email Template.
              Each prompt template type is associated with its prompt template type in Prompt Builder.
            3. For Recipient, select Contact.
              Selected prompt template type and recipient for the flow in Flow Builder
          5. Add the Get Records element and configure it.
            1. For Label, enter Get Events.
            2. For Object, select Event.
            3. For Condition Requirements, select All Conditions Are Met (AND).
            4. For Field, select Archived.
            5. For Operator, select Equals.
            6. For Value, select False.
            7. Click Add Condition.
            8. For Field, select Location.
            9. For Operator, select Contains.
            10. For Value, select Prompt Template Input then Contact then Mailing City.
            11. Click Add Condition.
            12. For Field, select Location.
            13. For Operator, select Contains.
            14. For Value, select Prompt Template Input then Contact then Mailing State/Province.
            15. For How Many Records to Store, select All Records.
              The Get Records element where three conditions are specified and All records is selected under How Many Records to Store.
          6. Add the Decision element and configure it.
            1. For Label, enter Any Events?
            2. For Select Decision Logic, select Define Manually (Default).
            3. On New Outcome, for Outcome Label, enter Yes.
            4. For Condition Requirements to Execute Outcome, select All Conditions Are Met (AND).
            5. For Resource, select Events from Get_Events.
            6. For Operator, select Is Null.
            7. For Value, select False.
              Selected field values for the Yes outcome in Flow Builder
            8. Click Default Outcome.
            9. For Label, delete the text, and enter No.
          7. On the No outcome path, add the Add Prompt Instructions element.
            1. For Label, enter: Add Note About No Events.
            2. For Prompt Instructions, enter: No upcoming events near you..
              Entered text for prompt instructions field in Flow Builder
              If the flow takes this outcome path, the flow stores this text in the $Output global variable. When the flow finishes, the flow passes the text to the sales email prompt template.
          8. On the Yes outcome path, add the Loop element.
            1. For Label, enter Add Events.
            2. For Collection Variable, select Events from Get_Events.
              Selected value for Collection Variable in Loop element
          9. On the For Each path, add the Add Prompt Instructions element.
            1. For Label, enter: Add Event Details.
            2. For Prompt Instructions, enter:
              Event details: {!Add_Events.Subject}, {!Add_Events.Description}, {!Add_Events.Location}, Start Time: {!Add_Events.StartDateTime}.
              Entered text for prompt instructions field

              If the flow takes this outcome path, the merge fields are replaced with Salesforce data such as the subject, description, location, and start time text for an event. The flow stores the prompt instructions text in the $Output global variable. Each time the flow executes the Add Prompt Instructions element, the text is appended to existing text in the $Output global variable. It can contain details about multiple cases. When the flow finishes, the flow passes the text that's stored in the $Output global variable to the sales email prompt template.

          10. Click Save.
            1. For Flow Label, enter: Get Marketing Events.
            2. Click Save, and then click Activate.
            Flow Builder canvas that shows complete flow

          Now that you completed the flow, you create a sales email prompt template in Prompt Builder. You add the flow to the prompt template. When you preview the prompt template in Prompt Builder, it triggers the flow to run, and the flow sends its prompt instructions to the prompt template.

           
          Loading
          Salesforce Help | Article