Omni-Channel Routing

Omni-Channel is a feature that can be used in the Sales or Service Console which when once enabled and configured, automatically pushes work to your users in real time. Omni-Channel basically checks the assigned work items and then will route the work items to the most qualified, available support agents using the routing criteria that you define. There are few ways in which you can configure Omni-Channel Routing in your org. In this video, we will understand step by step on how you can configure those routing configurations

What is Omni-Channel Routing?

Omni-Channel is a tool that sits inside of either the Sales or Service Console that, once enabled and configured, automatically pushes work to your users in real time. Omni-Channel takes incoming work items and routes them to the most qualified, available support agents using the routing criteria that you define.

There are three ways from which we can do Omni-Channel Routing

  1. Queue-Based Routing
  2. Skill-Based Routing
  3. External Routing

Queue-Based Routing

You assign agents to queues, which typically represent a single skill. Omni-Channel assigns work items to a queue and then pushes work items to an agent who is a member of that queue.

Best Use Case of Queue-Based Routing

Best for smaller organizations that support a limited number of products

Skill-Based Routing

Skills-based routing looks at the skills required to complete a work item and matches these to the skills that are assigned to the agent.

Best Use Case for Skill-Based Routing.

Best for larger organizations that: Have many agents that support many products. Support products that require complex skill sets. Support customers in many countries or across multiple languages.

External Routing

A third-party routing implementation of your choice routes work items through Omni-Channel to agents via the Salesforce Service Console. A developer uses APIs to integrate the partner routing application with Salesforce.

Best UseCase of External Routing

Best for organizations that want to route work to the Salesforce Service Console while keeping the routing implementation that the organization currently uses.

Demo of Omni-Channel

YouTube video

Apex Code for Skill Based Routing

public class SkillBasedRoutingApexHours {
    @InvocableMethod
    public static void routingCasesToAgents(List<String> caseIds){
        //Create PSR
        //Add skills to the request for the case
        //Push it to queue
        List<Case> casesInserted = [SELECT id,subject from Case where ID IN: caseIds];
        LIst<Skill> allSkills = [SELECT id,MasterLabel from Skill];
       
        for(Case caseR : casesInserted){
            PendingServiceRouting psr= new PendingServiceRouting();
            psr.workItemId = caseR.Id;
            psr.RoutingType = 'SkillsBased';
            psr.RoutingPriority = 1;
            psr.CapacityWeight = 1;
            psr.ServiceChannelId = '0N95j000000fzyz'; //Use your own Service Channel ID
            psr.RoutingModel = 'MostAvailable';
            psr.IsReadyForRouting = FALSE; //DRAFT state
            Insert psr; //First Step is completed
           
            //Find Out The Skills Required for a fiven Case based on its Subject
            List<String> matchingSkillIds = new List<String>();
            for(Skill skillR: allSkills){
                if(caseR.Subject.contains(skillR.MasterLabel)){
                    matchingSkillIds.add(skillR.Id);
                }
            }
           
            List<SkillRequirement> skillToInsert = new List<SkillRequirement>();
            //Associate matching skills with PSR request
            for(String matchingSkillId: matchingSkillIds){
                SkillRequirement skillReq = new SkillRequirement();
                skillReq.SkillId = matchingSkillId;
                skillReq.RelatedRecordId = psr.id;
                skillReq.SkillLevel = 5;
                skillToInsert.add(skillReq);
            }
            Insert skillToInsert;
           
            //Push our request in to the queue
            psr.IsReadyForRouting = TRUE;
            Update PSR;
        }
    }
}

Please check this post for our old and upcoming session on Service Cloud. Here is playlist of our service cloud sessions recording

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 461

12 Comments

  1. Once again, Fine tuned Session from Khyati and Thanks Amit for giving us an opportunity to learn these concepts with Technical Use cases.

  2. Thank you Khyati and Thanks Amit for giving us an opportunity to learn these concepts with Technical Use cases.

  3. Good Explanation and Very Informative Session.
    Thanks Khyati and Amit Bhaiya.
    Another One step forward to Service Cloud Consultant Certification.

    Instead of Using Static ID We can Use Dynamic ID
    ====================================================================
    //To Follow the Best Practices of Apex, Avoiding HardCode ID we can Use SOQL Query
    // My ServiceChannel Name = Top_Priority_Billing_Issues

    ListServiceChannelList = [select id,DeveloperName from ServiceChannel where DeveloperName = ‘Top_Priority_Billing_Issues’ Limit 1];
    psr.ServiceChannelId = ServiceChannelList[0].Id;//Service Channel ID

  4. Is there a possibility to explore what happens if a Case is edited and needs to be reassigned based on Status change or change in skill? Seems like not a straight forward thing. Is this even possible?

    Has anyone explored this?

  5. Hi, Is there a possibility where we can enable all incoming chats to be available for all agents. Where agents can cherry pick the chats?

Leave a Reply

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