
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 05-25-2019 08:27 AM
Hi there,
When using a Carrousel in the Virtual Agent, the user has to select one of the options. Would it possible to exit the carousel? Exit without selecting any of the options? If I understand the ServiceNow Support video, then this should be possible! On about minute 3 and 0 seconds in the video, it's mentioned: "If none of those are correct, the user can select none of the above".
Unfortunately though, achieving this is not an out-of-the-box feature of Virtual Agent. There is an enhancement request open to exit the carousel, but until then, maybe this could help you.
Out-of-the-box usage
The Carousel is set through scripting Carousel Item Expression within the User Input Carousel. The return value expects a JSON formatted code containing "Name", "Value", and "Body". Name containing the message to display, value the value, body the URL to the image. Ideally, this JSON is generated dynamically, through a GlideRecord query, etc..
For example, below the code used within out-of-the-box topic "Order an Item".
(function execute() {
var results = JSON.parse(vaVars.results);
var baseURL = gs.getProperty('glide.servlet.uri');
var options = [];
for (var i=0; i< results.length; i++) {
options.push(
{
'Name': results[i].title,
'Value': i + '',
'Body': baseURL + '/' + results[i].image
}
);
}
return options;
})()
Adding an exit option
So how to extend this with an option to exit the carousel? Well actually, this is pretty easy to achieve! Just add an additional option, JSON formatted. Looking at above example, just through options.push.
options.push(
{
'Name': gs.getMessage('Oops, this is not I was after'),
'Value': 'stop',
'Body': baseURL + '/' + 'qt-va-core-carousel-stop.jpg'
}
);
The result
---
And that's basically it!
Note: The image we used: https://sanquindev.service-now.com/sqn-va-core-carousel-stop.jpg
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful. Interested in more articles, blogs, videos, and Share projects on Virtual Agent I published? - Virtual Agent |
Kind regards,
Mark
---
- 1,989 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Great article -- would you happen to know where the property that sets the background color of the catalog item carousel widget? Screenshot of ours below. I'd prefer it was white to pass through the actual colors of the icons. Not sure where this blue/grey color is coming from. Thanks!

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Actually I don't know about the background color. Can you post your question in the Virtual Agent and Natural Language Understanding (NLU) community? Others will spot your question there and might have an idea on this.
Kind regards,
Mark

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
How do you upload the image for this to work?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi there,
You can just upload the image to the Images table.
System UI > Images
Kind regards,
Mark
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark,
Can it be utilize for showing KB article results ?