Carousel Script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 05:45 AM
Hi Community,
I'm designing a new topic to request a Catalog Item. First step is to ask the category, then to display all the Catalog Item related to it. For that, I want to use a carousel. I took inspiration of an existing OOTB Carousel Items script but mine is not working and I cannot find why... Does someone see a mistake in my script?
(function execute() {
var baseURL = gs.getProperty('glide.servlet.uri');
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('category', Category);
gr.addQuery('active', true);
gr.query();
var options = [];
for (var i=0; i < gr.length; i++) {
options.push(
{
'Name': gr[i].name,
'Value': gr[i].sys_id,
'Description': gr[i].description,
'Body': baseURL + gr[i].picture
}
);
}
options.push(
{
'Name': gs.getMessage('None of these'),
'Value': gr.length + '',
'Body': baseURL + 'not_viewable.png'
}
);
return options;
})()
Thanks in advance !
Arnold.
- Labels:
-
Virtual Agent
-
Virtual Agent Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 06:40 AM
Please copy+Paste this code and let me know
(function execute() {
var baseURL = gs.getProperty('glide.servlet.uri');
var cat = vaInputs.Category.getDisplayValue() || vaInputs.Category.getValue();
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('category', cat);
gr.addQuery('active', true);
gr.query();
var options = [];
for (var i=0; i < gr.length; i++) {
options.push(
{
'Name': gr[i].name,
'Value': gr[i].sys_id,
'Description': gr[i].description,
'Body': baseURL + gr[i].picture
}
);
}
options.push(
{
'Name': gs.getMessage('None of these'),
'Value': gr.length + '',
'Body': baseURL + 'not_viewable.png'
}
);
return options;
})()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 09:00 AM
I tried your code, but the outcome is still the same