
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 03-29-2019 10:38 AM
Hi there,
While the out-of-the-box Order an Item ITSM Conversation for the Virtual Agent is a rather small topic, it does provide users with a valuable chat. But what if we could raise the level of this conversation?
Some thoughts and experiences here to share with you.
Record Producers not shown
The Script Action Utility "Contextual Search" is filtering the results out if they match certain tables. The tables excluded are set in Script Variable "filter tables". Out-of-the-box filtered out tables are
sc_cat_item_content,sc_cat_item_producer,sc_cat_item_wizard,std_change_record_producer,sc_cat_item_producer_service
So missing a Catalog Item? Have look at these tables.
Carousel showing 5 results maximum
Again the Script Action Utility "Contextual Search"… amongst others, it's checking the value of Script Variable "limit". Results up to that value are shown. Out-of-the-box limit is set on:
5
Wish to see more results? Just increase the number.
Display top results first
Out-of-the-box there's no real clever thought about the display order for the results. It might be there are 9 Catalog Items about "SAP", though which ones are shown to you? Or even which aren't showed?
Our thought was: "Could we somehow display popular Catalog Items first?" Knowing there is an out-of-the-box "Service Portal Log Entries" available, we might be able to utilize that.
Just before the User Input Carousel "Catalog Item" we embedded a Script Action Utility with the below script. Most importend part is performing a GlideAggregate count on the "sp_log" table with a query on field "type=Cat Item View^ORtype=Cat Item Request". The result of the count will then be added to the JSON object, and the JSON object sorted on… the count 🙂
(function execute() {
var result = JSON.parse(vaVars.results);
for(var i = 0; i < result.length; i++) {
var ga = new GlideAggregate('sp_log');
ga.addEncodedQuery('id=' + result[i].sys_id + '^type=Cat Item View^ORtype=Cat Item Request');
ga.addAggregate('COUNT');
ga._query();
if(ga._next()) {
result[i].count = ga.getAggregate('COUNT');
}
}
var sortByProperty = function(property) {
return function(x, y) {
return ((x[property] === y[property]) ? 0 : ((x[property] < y[property]) ? 1 : -1));
};
};
result.sort(sortByProperty('count'));
vaVars.results = JSON.stringify(result);
})()
Contextual search
The Contextual Search could be changed from within the Platform UI. Navigating to:
Contextual Search > Searchers > Catalog only, selecting "ITSM VA Catalog Item Search" from Related List "Search Contexts" will give you some nice options to play around with.
For example, notice checkbox "Enable wildcard searches". Aha, that's why I don't get any results chatting to the Bot "Note", while I do get results on "Notebook".
Or interested only in Catalog Items which are associated with some Catalogs? Have a look at record "catalog" under Related List "Resource Configurations", from there have a look at record "Catalog Name" under Related List "Search Resource Context Properties". You could, for example, add "Service Catalog" as value, which limits the results to just the Service Catalog.
Carousel exit
Though the Service Support video mentions "If none of those are correct, the user can select none of the above", you can't actually exit the carousel. (checked with HI!)
To be able to exit the carousel we've set up a workaround. Workaround being an additional last option which is added to the carousel which looks like:
The actual coding is not that difficult. Just add one option after the for loop in the "Carousel Item Expression":
options.push(
{
'Name': gs.getMessage('Oops, this is not I was after'),
'Value': 'stop',
'Body': baseURL + '/' + 'qt-va-carousel-stop.png'
}
);
Blanc search term error handling
Out-of-the-box a consumer could just hit enter upon entering a search term. To provide some error handling, you could add a Decision Utility which checks whether the given value was blanc or not. We choose to do this Low Code and not No Code.
No Code just checks for blanc or not, while with Low Code you could trim the results for possible spaces entered.
(function execute() {
return vaInputs.search_term.getValue().trim() != '';
})()
Chat satisfaction survey
And of course, at the end of the conversation, we've implemented our chat satisfaction topic. The chat satisfaction topic is explained in this community article.
Summary
The out-of-the-box Order an Item topic does offer a solid base to start with. Though, with some slight adjustments, you could enhance the topic a lot!
---
Hope that this helps some of you! Questions or ideas? Let me know!
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
---
- 3,096 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark,
It seems the NewYork version of topic "submit request" have out of box functionality to ask questions to fill a request.
There is a check on "has VA support" in the flow, based on :
var itemJSON = new sn_sc.CatItem(results[index].sys_id).getItemForVA();
Do you have an idea of how we can set "has VA support" to true for an item.
Using this out of box functionnality seems more appealing to me than the custom coding you proposed on: https://community.servicenow.com/community?id=community_question&sys_id=08c5a6a91bfaf340ada243f6fe4b...
Regards,
Guillaume

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Indeed, New York looks to offer a nicer / easier / maintainable functionality for this. I haven't looked into in dept, still have to do 🙂 Will let you know if I have more on this.
Above will work of course, if someone is still on a pre-New York version.
Kind regards,
Mark
---
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Guillaume,
I stumbled upon this myself - we do not have the ability to set 'has VA Support' to true for catalog items. It is determined at runtime based on the following, which I found here:
- A user can submit a request in the conversation by answering the questions in line. This is possible only if the item does not have any scripts or policies, does not have mandatory attachments, and contains any of the following variable types:
- Date
- Reference (with no pricing implications)
- Single Line Text
- Wide Single Line Text
- Yes / No
- In all other cases, Virtual Agent provides a link for the user to submit a request in Service Portal.
Note: In case you want to redirect to a portal other than Service Portal, specify the portal for the sn_itsm_va.com.snc.itsm.virtualagent.portal_url property.