Virtual Agent Routing: Re-checking vaSystem.isLiveAgentAvailable()

India T_
Mega Guru

Hello I am interested in how to create a after hour queue for live agents. 

Using Topic Blocks with context application variables to route to queues. 

 

find_real_file.png

For example:

1. In a flow screenshotted above, we have configured routing to a country specific topic block then going to the first "Live Agent" script which includes:

(function execute() {

 if(vaSystem.isLiveAgentAvailable()) { 
           vaSystem.connectToAgent()
        }
           
})()​

If there are agents available, routing is properly going to the designated queue based on topic block. After the conversation has completed, the chat closes and the remainder of below steps are obsolete. <Working>

If there are no agents within that specific topic block (due to a working schedule) then there should be NO output in virtual agent chat window because we have added the line " if(vaSystem.isLiveAgentAvailable())" <Working>

2.  Output of "Must be after hours" inside "Quick test" utility shown above. <Working>

3. A decision with conditions to validate if the end user selected option HR or IT from a previous question in the flow. <Working>

----- What is not working as expected -----

4. Based on decision from Step 3, assigning another topic block for routing. Example script inside topic block:

(function execute() {
vaVars.LiveAgent_application = 'enit';
vaSystem.isLiveAgentAvailable();
})()

Note: The default queue has condition to include context application == enit

find_real_file.png

5. Then finally send end user to default live agent queue with simple code:

(function execute() {

 vaSystem.connectToAgent();
})()

 

Receiving results:

If there is no agent in the first check for Live Agent (Step 1), its not rechecking for the default Live Agent (Step 5). Its automatically stating "no agents available".

find_real_file.png

Alternatively I have tried following:

Adding a additional Assignment Eligibility and setting eligible at 30 seconds.
For example 9am - 5pm IST is the Queue schedule
First designated group will be eligible at 0 seconds. <Lets say all agents are offline>
Second designated group ENIT (default) will be eligible at 30 seconds. <This will only work if the agents are online within the queue schedule>

Open for Suggestions:

1) How to re-check Live agent script per flow explained above?
2) How to clear a topic block routing or reassign?
3) Any suggestions for doing a after hour queue?

1 ACCEPTED SOLUTION

Thank you Chris, you are so kind. After doing a bit more research and testing, we realized the context application was being set correctly. However the isLiveAgentAvailable function was not given enough time between the first Queue check and the second Queue check. After inserting a 5 or 10 second PAUSE utility this actually fixed the issue.  Thank you for your suggestions and time!

View solution in original post

4 REPLIES 4

Chris D
Kilo Sage
Kilo Sage

First off, very well documented - I don't think there's any room for interpretation or clarification here which is great.

That said, the system not checking agent availability a second time seems problematic. I don't have the exact scenario you have, but I do have a simple loop built into one live agent transfer, where if there is no agent available, it asks the user to click a button to try again (after waiting a few minutes ideally), and if they click that button, it just loops back to the live agent transfer topic block which retries the agent availability check. The difference I guess is that I'm not changing the conditions/context variables.

There's a good chance you may just be running into this known error, KB1005021Agent availability check using 'vaSystem.isLiveAgentAvailable' API does not always work as expected ...

If that's the case (maybe open a ticket to Servicenow and they can confirm), I'm not sure there's a great fix for that... I am wondering about the logic you're using in your topic flow and I think you may be able to achieve it more simply via AWA logic.

Think about how AWA works: it uses the order of the queues to determine which ones to try first, and it checks the condition one-by-one until it finds one that matches with an available agent. So using your example you'd have three separate queues: your main queue, your second queue for app A, and your third queue for app B (#2 and #3 orders don't really matter) - then just do one single agent availability check in the VA topic and let AWA handle the routing. Does that make sense?

Thank you Chris, you are so kind. After doing a bit more research and testing, we realized the context application was being set correctly. However the isLiveAgentAvailable function was not given enough time between the first Queue check and the second Queue check. After inserting a 5 or 10 second PAUSE utility this actually fixed the issue.  Thank you for your suggestions and time!

Nitin Agarwal1
Tera Expert

Hi @India T_  - Will you be able to explain how you achieved :

Output of "Must be after hours" inside "Quick test" utility shown above.

 

Eager to understand this critical step in a similar requirement I have.

johndoh
Mega Sage