Is there a way to Prioritize the Order of Cases in Omni-Channel? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Brendan ConroyBrendan Conroy 

Is there a way to Prioritize the Order of Cases in Omni-Channel?

I'm trying to figure out if there is a way to use Omni-Channel (I'm open to other options of course) for Cases and ideally Live Agent that allows the Cases that assigns Cases to an Agent, but prioritzes them. In my testing, Omni-Channel seems like it sorts the list of Cases/Live Agent from oldest to newest based on date/time opened. That is great, but I'm trying to figure out if I can add another level to it without going the custom code route. 

There is a field for Priority on the Contact related to the Case (High, Medium, Low). I would like it that the sorting for the agent's cases to be essentially first sorted by this Priority and then by when it was created. Here's the break out

1st High Priority and most recent
2nd High and descending
3rd Medium most recent
4th Medium descending
5th Low most recent
6th Low descending
7th no contact

In other words, if there is a High Priority Case that is 5 days old and a Medium Case that is 20 minutes old, the Priority Case should be on top for assignment. I'm pretty sure that this isn't out of the box functionality, so I looking for options even if it's not omni-channel.  Thanks
Jeff MayJeff May
Since Omni Channel routes "Work Items" (which can be Cases, Chats, other items), you can prioritize the Work Items as needed. However, within an work item queue, the items are routed oldest-newest.
Brendan ConroyBrendan Conroy
Hi Jeff, Yeah. I can't seem to find a way to factor in the Priority of the Contact associated to the Case. So the end to end use case is, "the case should be sent to the agent based on the Contact of the Case's Priority and they should have an interface where they see the most recent Cases and can accept or reject it (with a reason)". Ideally we would be using omni-channel so that they can have Live Agent there too, but this request might break that process (outside of custom dev). Can you think of any other way to essentially have a view within omni-channel or even a list view where we can essentially sort it twice (ie by priority AND date/time opened) without code? Thanks
Andrew BoettcherAndrew Boettcher
Brendan, were you ever able to figure this out?
Andrew BoettcherAndrew Boettcher
(or Jeff!)  :)
Brendan ConroyBrendan Conroy
Hey buddy! Yes, I was able to do a variation on it which met the need. I would have a queue for each Priority, have the routing priority be based on that queue's priority, and have the case assignment rules push the Cases into the different priority queues based on criteria (ie if the Case priority is High, push to P1). I would have Live Agent as it's own routing configuration and assign Users who use Live Agent to that queue. I also had escalation rules saying that after "x" amount of time, move the Case into an escalated queue and elected to have a hierarchy of escalated queues (ie P2 goes to Escalated P2 and after "y" amount of time, move it to Escalated P1, etc).
Marc D. BehrMarc D. Behr
This is possible if you write some code. I wrote a class that allows you to move a record in an omni-channel queue to the top of the list. I need to clean it up a bit, but then I can try to release it
Brendan ConroyBrendan Conroy
True. I found that I could have a similar set up using an escalation queue meaning it gets moved to a separate queue after "x" amount of time and thus is put higher in the routing order.
Mohammad Asim AliMohammad Asim Ali
@Marc - Could you please give more detail about which object and field you used to manipulate the order in the same queue?
Abdul HassanAbdul Hassan
@Marc, What object would you target in your trigger/batch code to move records in omni-channel based on some criteria of your own?
Marc D. BehrMarc D. Behr
You need to update the CustomRequestedDatetime field on the PendingServiceRouting object record that relates to the queued record
Abdul HassanAbdul Hassan
Will that be on a update Trigger on the PendingServiceRouting object Marc? 
Marc D. BehrMarc D. Behr
Triggers don’t fire on Omni-channel activities. You will need to fire the update based off different criteria (for example, when a case changes status, to X you could fire a trigger off that and change the priority of something in a queue), or you could create a schedulable class that rearranges the queue every 5 minutes
Abdul HassanAbdul Hassan
brilliant. thanks Marc. this been baffling me for some time
Abdul HassanAbdul Hassan
Hi @Marc, i tried updating the CustomRequestedDateTime field for a record which was sitting in PendingServiceRouting object, but i got an error Custom Requested Date (01/03/19 11:55) In The Future.

How did you manage to re-priotise a Case using this object?
Marc D. BehrMarc D. Behr
You can’t move an event to the future, only to the past, but at a specific point in the queue. So you need to read all of the queued items, find those in the queue that you are interested in, then find the position in the queue where you want this entry and take its CreatedDate and offset the CustomRequestedDateTime for the selected entry to place it into the queue at that point. I will see if I can make what I have more generic so others can use it as a DX package
Gabriel NasayaoGabriel Nasayao
Hi Marc,

Using CustomRequestedDatetime on PendingServiceRouting seems to be working. When I updated the CustomRequestedDatetime to an old date, those records appear first on the Omni Channel Queue
Yusuf KaydawalaYusuf Kaydawala

Hello Brendan,

I would recommend the below approach:
1) Create a process builder on the Case object. Here you can read the case priority, case contact, and other attributes to update the case priority of your choice i.e., high, medium, low, etc.
2) Setup Omnichannel to route the case object records. Enable and use the secondary routing feature to create a routing on the case status field.

a) If Salesforce gets one high and one medium priority case, the high priority case will be routed first
b) If Salesforce gets two high priority cases at the same time, the first high priority case will be routed first.

Adam PinderAdam Pinder
until this functionality is available with omni-channel take a look at our product Q-assign on Salesforce appexchange which can do this with or without omni-channel in use.

Ines GarciaInes Garcia
Hi Adam, please refrain to self promote hard sales here, this forum is not the place. As an appexchange official partner you have tons of resources and an extremly experienced team there to help you with an actual go to Market strategy which wont have a detrimental effect to your brand. Take advantage!