OmniChannel – Check Agent Availability Core Action for Smarter Case Routing

A messaging channel has been setup, let’s say legacy chat or MIAW (Messaging for InApp and Web). All the necessary configurations such as queues/skills, agents, and routing are also configured. Hence, The positive test case scenario when the agents are available will work as expected. How about the negative test case? What should happen when no agents are available to accept the messaging request? It’s quite possible, right? Let me introduce you to a gem of a feature offered by the OmniChannel flow which is ‘Check Availability for Routing’ core action.

Step 1: Select the desired Service Channel and the object

  • Pick the desired Service Channel. This is a lookup field that shows all the records from the ServiceChannel object. Alternatively, you can see these values from Setup – Service Channels. 
  • This is a dropdown with the fixed values (like a restricted picklist field). Pick the value based on the routing need. For this demonstration, I will go ahead with ‘Queue’.

Step 2: Select the desired Queue/Skill/Agent

The labels and fields in this section are reactive to the value that has been selected above. As I selected ‘Queue’ above, Select the Queue name for which we need the availability of the agents (i.e., the users in the queue who are online)

Step 3: Select the Output variable

Regardless of what object is selected in 2, Salesforce offers three values out of which the ‘Return all’ is an array which holds the values of the first two options as well. I am going with the last one.

Step 4: [Optional] Manual Variable Assignment

All of us are familiar with this option from the regular flows which is to manually assign variables and use them subsequently.

More detail description of the three variables (Source: Salesforce Help)

Estimated Wait Time (in seconds)The action returns the estimated wait time (in seconds) given the specified routing parameters. For example, if you route work to a queue, this parameter shows the estimated time that the work can remain in the queue before an agent picks it up.Omni-Channel recalculates estimated wait time based on work routed during the last 10 minutes. If less than 10 items were routed, we can’t calculate it.Wait times are calculated based on primary (not interruptible) work items in the queue. Interruptible work isn’t included in the calculation.
Number of Online AgentsThe action returns the number of agents who are online but not necessarily available to accept more work—they could be working at capacity. If you route to an agent, this value is 0 (the agent is offline) or 1 (the agent is online). If you route to a queue, this value is the number of online agents assigned to that queue. If you route to a skill, this value is the number of online agents who have the specified skillset.
Number of Queued Work ItemsThe action returns the number of items waiting to be picked up, which excludes items assigned to or accepted by agents. If you route to an agent, this value is the number of PSRs directly assigned to the agent without a fallback queue. If you route to a queue, this value is the number of PSRs assigned to the queue, including PSRs assigned to a specific agent with this queue as the fallback queue. If you route to skills, this value is the number of PSRs that share the exact same set of mandatory skill requirements, both skill and skill level, used in the action.Queue size is calculated based on primary (not interruptible) work items in the queue. Interruptible work isn’t included in the calculation.

Step 5: Key step – Decision element check for routing

All the values that are returned by the action can be accessible from the collection. Check if the OnlineAgentCount is equal to zero in one branch and greater than zero in another to route it to the right queue. From the Agents Online branch, one more decision element can be added to route it to the specific queues using the RouteWork core action.

Step 6: Display a custom message for the users when no agents are online

Create a text variable in the flow with exactly the same name as reasonForNotRouting and mark it as available for Output and then assign a value to this variable in the No Agents Online branch.

The result on the chat window looks like this


Implementing these simple steps will result in the following benefits

  • Enhances customer experience by avoiding situations where users wait in a queue with no available agents.
  • Improves agent efficiency by preventing them from being assigned chats or messages they can’t handle immediately.
Anand Dosapati
Anand Dosapati

Salesforce Solution Architect

Articles: 2

Leave a Reply

Your email address will not be published. Required fields are marked *