Virtual Agent script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 02:57 AM
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
@Community Alums @Mark Roethof @Ankur Bawiskar @Community Alums

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 07:35 AM
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?
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 07:52 AM
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.';
}
})()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:23 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:56 AM
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