---
schema_version: "1"
id: b2e9dd16e2a1775353588baa88bffc6485660c0bf196baf7811d5d0b1a317bbf
title: Update Your Routing Logic for Agentforce Service Agent on Email
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/service_agent_email_routing.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.service_agent_email_routing.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 6df51b96a6e908fa59a6af9c47c1c007a336e1a345faa454411b067912e7a054
description: Nearly all of the puzzle pieces are in place, but Salesforce still needs to know when the agent should use your email template to email customers. We recommend creating an Omni-Channel flow that controls which cases are routed to your Agentforce Service agent versus a service rep.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Update Your Routing Logic for Agentforce Service Agent on Email

Nearly all of the puzzle pieces are in place, but Salesforce still needs to know when the agent should use your email template to email customers. We recommend creating an Omni-Channel flow that controls which cases are routed to your Agentforce Service agent versus a service rep.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col>
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and
              <strong>Developer</strong> Editions. <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;release=264.0.0&amp;type=5" title="Learn about agent types and default templates for specific clouds and common use cases.">Required
                add-on licenses vary by agent type.</a>
            </td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <p><span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/resources-global/_corporate/images/checkmark.png" alt="Check mark"></span>This article applies to: Agentforce Service agents</p>
              <p><span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/resources-global/_corporate/images/crossmark.png" alt="Cross mark"></span>This article doesn't apply to: Agentforce Employee agents</p>
              <p style="margin-bottom:0;">To learn about channel support for other agent types, see the documentation for
                that type.</p>
            </td>

          </tr>
        </tbody>
      </table> <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d161800e105">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">To create email templates:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">Lightning Experience User </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">To edit public email templates:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">Modify All Data, Manage Public Lightning Email Templates, or template
              ownership</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">To create Agentforce Service Agent email configurations:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">Manage Agentforce Service Agents AND Manage AI Agents OR Customize Application</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">To edit routing addresses:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">Customize Application</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">To create Omni-Channel flows:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d161800e105 ">Customize Application</td>

          </tr>
        </tbody>
      </table>

## Create an Omni-Flow

Use the route work action to set your Omni-Channel flow to route cases to the Agent Context User. This is an inbound flow to connect a case to an agent. You may choose to create an additional outbound flow that escalates a case to a service rep if an agent can’t answer.

1. [Complete Omni-Channel setup](https://help.salesforce.com/s/articleView?language=en_US&id=service.omnichannel_enable.htm), including a service channel for cases and routing configurations.
2. When creating your inbound Omni-Channel flow, select the option to route cases to an agent, then select the Agent User. To determine the correct value, select your agent from the Agentforce Agents setup page, and look at the Agent User field.
    
    ![Inbound flow with the Route Work element routing to an AI Agent.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/asa_email_inbound_flow.png)
3. Make sure to select Required Agent in the Route Work action, and to create a recordId input parameter. If your flow has an input\_record variable, ensure that its object type is Case; otherwise, the flow won't work. If you intend to use the same flow across multiple channels, it’s best to include only a recordId input variable to avoid mismatches with the input\_record object type and the channel.

## Link the Flow to Your Routing Address

After you create your flow, link it to your routing address.

1. From Setup, enter Email-to-Case in the Quick Find box, then select Email-to-Case.
2. In the Routing Addresses section, click Edit next to the routing address you were viewing earlier.
3. Under Flow Settings, select the Omni-Channel flow that includes routing to your Agentforce Service agent, and select a fallback queue to receive cases if the flow isn’t available. Note: Skills-Based and Direct-to-Agent routing must be enabled under the Omni-Channel settings page in Setup.
    
    ![Omni-Channel Flow and Fallback Queue fields filled out according to these instructions.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/asa_email_route_3.png)
4. Save your changes.

As an alternative to an Omni-Channel flow, you can simply set the Case Owner of your routing address to the context user for your agent listed under the Agent Details tab in Agents setup, or create a Case Assignment Rule to do the same. This is a quick way to get up and running, but it doesn’t provide the same level of granular control that a flow does.

Case owners must be assigned during the case save operation. Delayed or asynchronous assignment to Agentforce will prevent the system from sending an automated response until the customer emails again because the case must be owned by Agentforce when the inbound email is processed.

## Configure the Escalation Subagent

Use the Escalation subagent to route work to a service rep when a customer is frustrated. This is the second flow that you’ll create in the setup process.

- Agentforce Service agents can tell when an end user is frustrated with an interaction, and can use the Escalation subagent to transfer the inbound email to a service rep. [Learn more about the Escalation subagent and how to configure it.](https://help.salesforce.com/s/articleView?id=ai.service_agent_escalation.htm&release=264.0.0&type=5 "When an agent encounters conversations that it can’t resolve, it uses the Escalation subagent to escalate the conversation. In the new Agentforce Builder, you can also run the Escalation subagent using the escalate utility function in Agent Script. Escalation and transferring works differently depending on the agent type and channel. You can customize the experience that customers receive when transferring isn’t possible.")
- When a case is escalated, your outbound flow is triggered and changes the Case Owner from the AI service agent to a service rep.
    
    ![Outbound flow with the route work element routing to a service rep.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/email_asa_outbound_flow.png)
- If you remove the Escalation subagent or choose not to configure a routing flow for escalation, the escalation flow won’t work.
- Agentforce Service agents connected to email don't use the escalation message defined for the agent. When an Agentforce Service agent connected to email escalates a conversation, no response is sent and the agent doesn’t send any more automated emails.
- If using the same flow to route multiple types of records, don’t use an input\_record variable in your flow, as this variable must be linked only to one type of record and the flow will not work for other types of records.