Virtual agent not allowing new conversation

Kri
Tera Guru

I created custom LIVE AGENT and configured the Chat window connecting End Customer directly to the Live Agent while opening from the below community but I face the issue when End Customer requesting Live Agent where they are OFFLINE status then it is giving 'no agents available' message but it is not allowing to open New conversation instead the End Customer needs to refresh the whole page for that

https://www.servicenow.com.mcas.ms/community/virtual-agent-nlu-forum/how-do-i-bypass-disable-virtual...

@Community Alums 

43 REPLIES 43

Just an FYI but that will break later on, they are now using a different format. Virtual Agent scripts (servicenow.com).  

That is why in my script I linked above I am using switchTopicById.

No "vaSystem.topicDiscovery()" is fine. The use of "vaSystem.switchTopic()" is not oke anymore and should be replaced with "vaSystem.switchTopicByName()" or "vaSystem.switchTopicById()". 

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

You are correct, I was mistaken. What happens with lack of sleep 🤣

johndoh
Mega Sage

In addition, we are using a third party for call/chat handling so the agent status's never change in AWA and that caused me some issues like you are having. I in turn created a on update business rule on the awa_agent_presence table to keep the Virtual Agent account online. The condition is 'Current presence state' is not 'Available'. I do have scheduled jobs set to turn on and off the Virtual Agent (same code as below) and the beginning and end of the day. For the turning on of the Virtual Agent I have a conditional item set.

 

(function execute() {
    var VAagent = new GlideRecord('awa_agent_presence');
    VAagent.addEncodedQuery('agent=ENTER SYS ID HERE OF ACCOUNT');
    VAagent.query();
    while (VAagent.next()) {
        var gdt = new GlideDateTime();
        var localTime = gdt.getDisplayValue().toString().split(' ')[1];
        var dayOfWeek = gdt.getDayOfWeekLocalTime();
        var hour = localTime.split(':')[0];
        if (hour > 19 || hour < 8 || dayOfWeek == 6 || dayOfWeek == 7) {
            //After Hours				
            VAagent.current_presence_state = '9cd83267575313005baaaa65ef94f98b'; //sys_id for Offline
            VAagent.setWorkflow(false); //Do not run business rules
            VAagent.autoSysFields(false); //Do not update system fields
            VAagent.update();
        } else {
            //Work Hours
            VAagent.current_presence_state = '0b10223c57a313005baaaa65ef94f970'; //sys_id for Available
            VAagent.setWorkflow(false); //Do not run business rules
            VAagent.autoSysFields(false); //Do not update system fields
            VAagent.update();
        }
    }
})()

 

  Condition of turning on the Virtual Agent

function checkSchedule() {
	var schedule = new GlideSchedule("ENTER SYS ID HERE"); //THIS IS MY HOLIDAY SCHEDULE
	if(schedule.isInSchedule(new GlideDateTime())){   
		return true;
	} else {
		return false;
	}
}
checkSchedule();