Virtual Agent script not working

Kri
Tera Guru

I wrote the below script for Live Agent customization but I'm not getting the right output

(function execute() {          
if(vaSystem.isLiveAgentAvailable()) {    
   vaSystem.connectToAgent();     }     
else {       
return 'Live agent is not currently available. Please check back later.';     
}   
})()

Output

Krishna124_0-1686995700793.png


@Community Alums @Mark Roethof @Ankur Bawiskar @Community Alums 

6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

If your setup is similar to what I shared in your previous posts, it should be able to work. I just created it on my PDI (I don't have a customer with this at the moment), and after setting the Queue it works immediately.

 

Is your Queue correct?

 

2.png

 

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

I don't think it is issue with the Queue because when I write the script    vaSystem.connectToAgent(); it is connecting but when I add the below script it is not working and getting only Thanks you for using our Support chat message whenever opens the Chat window

(function execute() {          
if(vaSystem.isLiveAgentAvailable()) {    
   vaSystem.connectToAgent();     }     
else {       
return 'Live agent is not currently available. Please check back later.';     
}   
})()

Krishna124_0-1687013549127.png

 

 

Attached the topic with which I tested. If this still does not work, do look at your queue setup and/or agent chat configuration record.

 

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

Is this a Update set file you shared? I can't able to load this file in my instance

This is the configuration I have in the Agent chat record

Krishna124_0-1687017388298.png