Skill-Based routing using Omni channel Salesforce

on

|

views

and

comments

Hey Awesome admin, Welcome 🙂

In this blog post, we are going to learn how to implement Skills-Based routing in Salesforce using Omni Channel. By implementing Skills-Based routing it will help our representatives to be more productive & resolve the query in a very quick way. We are going to follow the set of steps that are given below.

Enable Skill-Based Routing under Omni Channel Settings.

Create Required Skills

To assign the skills to our Agents, we need to have some skills so that we can assign them to Service Resources ( Our agents )

Create Service Channels

Service channels are the different ways by which our customers can connect with us. Like Cases, Live Agents, Messaging & etc. In our example, we will create for cases.

Create Presence Status

Presence status are the various options that an Agent can select like, Online, Out for Break, Offline, Out for Lunch, Available for Cases & etc.

  • Edit Service Resource Object Page Layout & Add Skills as Related List
  • Create custom fields into Case Object

Create an Apex Class & Create a Process Builder

Refer the below image for Process Builder

Find the code for apex class

Global class SkillsBasedRouting {
    
    @ InvocableMethod
        public static void routeUsingSkills(List<String> cases) {
            
            List<Case> caseObjects = [SELECT Id, Description, Language__c FROM Case WHERE Id in :cases];
            
            for (Case caseObj : caseObjects) {
                // Add SkillsBased PendingServiceRouting
                PendingServiceRouting psrObj = new PendingServiceRouting(
                    CapacityWeight = 1,
                    IsReadyForRouting = FALSE,
                    RoutingModel  = 'MostAvailable', //LeastAvailbale
                    RoutingPriority = 1,
                    RoutingType = 'SkillsBased',
                    ServiceChannelId = getChannelId('Case'),
                    WorkItemId = caseObj.Id
                );
                insert psrObj;
                psrObj = [select id, IsReadyForRouting from PendingServiceRouting where id = : psrObj.id];
                System.debug(' \n **** psrObj **** \n'+psrObj);
                // Now add SkillRequirement(s)
                SkillRequirement srObj = new SkillRequirement(
                    RelatedRecordId = psrObj.id,
                    SkillId = getSkillId(caseObj.Language__c)
                    //SkillLevel = 10
                );
                insert srObj;
                
                // Update PendingServiceRouting as IsReadyForRouting
                psrObj.IsReadyForRouting = TRUE;
                System.debug('\n **** psrObj *** \n'+psrObj);
                update psrObj;
            }
            return;
        }
    
    public static String getChannelId(String channelName) {
        ServiceChannel channel = [Select Id From ServiceChannel Where DeveloperName = :channelName];
        return channel.Id;
    }
    
    public static String getSkillId(String caseLanguage) {
        String skillName = 'English';
        if (caseLanguage != null) {
            skillName = caseLanguage;
        }
        
        Skill skill = [Select Id From Skill Where DeveloperName = :skillName];
        return skill.Id;
    }
}

Create Service Resource & Assign Skills to Service Agents.

To Create the Service Resource, Navigate to Service Resource Tab -> Click on New & then create a Service Resource of Type Agent.

Now, as we have added the Service Resource, Click on the Related Tab and assign skills to agent.

Assign Presence Status to the Agents profile

Go to profile -> Edit the Profile to which you wanted to assign the Presence Status. Find “Service Presence Statuses Access“, Edit & then assign the presence status from Available Service Presence Statuses to Enabled Service Presence Statuses

Test Setup

Watch the video here

Sharing is caring 🙂 #KeepLearning #KeepSharing #AskPanther

Amit Singh
Amit Singhhttps://www.pantherschools.com/
Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion
Share this

Leave a review

Excellent

SUBSCRIBE-US

Book a 1:1 Call

Must-read

How to Utilize Salesforce CLI sf (v2)

The Salesforce CLI is not just a tool; it’s the cornerstone of development on the Salesforce Platform. It’s your go-to for building, testing, deploying, and more. As one of the most important development tools in our ecosystem

Save the day of a Developer with Apex Log Analyzer

Table of Contents What is Apex Log Analyzer? Apex Log Analyzer, a tool designed with Salesforce developers in mind, is here to simplify and accelerate your...

Salesforce PodCast

Introduction Hey Everyone, Welcome to my podcast, the first-ever podcast in India for Salesforce professionals. Achievement We are happy to announce that we have been selected as Top...

Recent articles

More like this

2 COMMENTS

  1. Hi,

    I followed all the steps shared by you, but still. Routing did not happened. Can you please help ? I did not receive case in omni channel widget after creating the case, i tried being offline then again online still case did not came to me in omni-channel widget.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

5/5

Stuck in coding limbo?

Our courses unlock your tech potential