Help with vaSystem.isLiveAgentAvailable() - it is not returning the correct result

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 11:55 AM
Hello! I am hoping someone can help me out with this issue. My current version is Utah and I am trying to figure out why the vaSystem.isLiveAgentAvailable() method is returning 'true' when there are no live agents connected. I have tested this in the designer and it gives me the correct result of 'false' but when I test it in a published topic, it tells me that there are agents I can chat with and when i click to be transferred, then it says there are no live agents available. I am confused and not sure what to do to fix it.
(function execute() {
//get live agent result
if (vaSystem.isLiveAgentAvailable()) {
vaVars.agentAvailable = 'true';
//get avg wait time for queue
var avgWait = new GlideRecord('awa_queue');
if(avgWait.get('609ff3561b49e050306b55392a4bcbba')){
vaVars.waitingTime = avgWait.average_wait_time.getDisplayValue();
}
}
else {
vaVars.agentAvailable = 'false';
}
})();
Is anyone experiencing the same thing? Any suggestions of what i can do?
Thank you,
Yen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 10:10 AM
Hello @YenGar ,
Hopefully this will help you 🙂 - Solved: How to handle agents online/offline status for Liv... - ServiceNow Community

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 01:50 PM
Thank you John! I had read that posting as well and decided to put the vaSystem.isLiveAgentAvailable() in a variable too like in the example but i get the same results. It works well in the designer when testing but it does not provide the correct result in a published topic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 01:55 PM
That is strange, if it works testing in the designer and you have published then it should work just the same in the web client. Glad you mentioned that as that was going to be the first thing I asked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 02:04 PM - edited 06-23-2023 02:13 PM
I dont think it should matter but have you tried to remove the quotes for the true/false? That way it is not a string return.
(function execute() {
//get live agent result
if (vaSystem.isLiveAgentAvailable()) {
vaVars.agentAvailable = true;
//get avg wait time for queue
var avgWait = new GlideRecord('awa_queue');
if (avgWait.get('609ff3561b49e050306b55392a4bcbba')) {
vaVars.waitingTime = avgWait.average_wait_time.getDisplayValue();
}
} else {
vaVars.agentAvailable = false;
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 02:31 PM
Yep, i tried that as well, even did a .toString(); on the value to go by that but i still get the same results. I did end up opening up a case and hoping they can provide a solution.