
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-07-2019 07:23 AM
Hi there,
While the out-of-the-box Check IT Ticket Status ITSM Conversation for the Virtual Agent is a rather small topic, it could potentially provide users with a valuable topic. So how can we raise the level of this conversation?
Some thoughts and experiences here to share with you.
Check Ticket Status instead of Check IT Ticket Status
First and foremost thing which is limiting the out-of-the-box topic: It only is about Incidents and Requested Items. Though what if you also want to know the status of Changes? Facility Requests? Stories? Or you've added a custom process, and you want to implement those tickets as well? The out-of-the-box Check IT Ticket Status topic, unfortunately, does not offer room to easily add different processes. Everything is hardcoded.
What we came up with, upon configuring the Check Ticket Status topic, a Script Variable "ticket_options" holds all information about the processes to support. Most imported coding being:
var options = [];
options.push(
{
"table":"incident",
"query":"active=true^caller_id=" + gs.getUserID(),
"fields": [
{"name":"short_description"},
{"name":"state"}
],
"comments":"comments"
});
options.push(
{
"table":"sc_req_item",
"query":"active=true^request.requested_for=" + gs.getUserID(),
"fields": [
{"name":"cat_item"},
{"name":"state"}
],
"comments":"comments"
});
options.join();
return JSON.stringify(options);
If for example, you just want to expand the topic with Change Request. Only code additional needed in this Script Variable:
options.push(
{
"table":"change_request",
"query":"active=true^u_requested_for=" + gs.getUserID(),
"fields": [
{"name":"short_description"},
{"name":"state"}
],
"comments":"comments"
});
options.join();
The Script Variable ticket_options is utilized thru out the whole topic. Already the first step, which is showing the active tickets created by the user. Instead of hardcoded steps, the Script Variable is parsed and generated an overview.
vaVars.index = 0;
var optionsObj = JSON.parse(vaVars.ticket_options);
var countInt = 0;
for(i = 0; i < optionsObj.length; i++) {
var gaTable = new GlideRecord('sys_documentation');
gaTable.addQuery('name', optionsObj[i].table);
gaTable.addNullQuery('element');
gaTable.addQuery('language', 'en');
gaTable._query();
if(gaTable._next()) {
optionsObj[i].label = gaTable.getValue('label');
optionsObj[i].plural = gaTable.getValue('plural');
}
var gaTable = new GlideAggregate(optionsObj[i].table);
gaTable.addEncodedQuery(optionsObj[i].query);
gaTable.addAggregate('COUNT');
gaTable._query();
if(gaTable._next()) {
if(gaTable.getAggregate('COUNT') > 0) {
optionsObj[i].count = gaTable.getAggregate('COUNT');
countInt = countInt + parseInt(optionsObj[i].count);
} else {
delete optionsObj[i];
}
}
}
vaVars.ticket_details = JSON.stringify(optionsObj);
vaVars.ticket_details = vaVars.ticket_details.replaceAll(',null', '');
vaVars.ticket_count = countInt;
Notice there is a "count" mentioned in this code, in the previous step, this has been added and represents the number of active tickets for this table.
Type of tickets and tickets for table selected
Based on the results, the topic ends or proceeds with defining which type of tickets to check. If a user has only active incidents, defining which tickets to check is automatically set to incidents.
The actual displaying of the type of tickets and tickets for the table selected is a very similar setup. Though again, dynamically done instead of hardcoded.
The "Next page" and "Previous page" options from the out-of-the-box Check IT Ticket Status topic is very solid. We just kept them 🙂
Number of tickets given in the choice list
You might wonder why out-of-the-box, only up to 5 tickets are displayed. The reason is pretty simple: the GlideRecord query gets a number which is set in Script Variable "limit". Out-of-the-box, this Script Variable is set to 5.
gr.chooseWindow(index, index + limit, true);
Exit choice list
We only added one option, is if the user wants to break out of the flow, made a wrong choice, etc.. The Virtual Agent does not offer such functionality, only having "New Conversation" under the More options.
<img>
<code>
Display record
The out-of-the-box Check IT Ticket Status Script Output Bot Responses "Display *" have a hardcoded link to the Platform UI. Be aware of this, you might want to alter this.
url: vaVars.base_url + vaVars.service_portal_base_url + '?sys_id=' + gr.getUniqueValue() + '&view=sp&id=ticket&table=incident',
Add comment
Also, the "Add comment" functionality is pretty solid. We kept this with just one adjustment: a check on the user input if it empty or not. While checking if the user input it is empty, we've chosen to do this Low Code and not No Code. With No Code, for example, a space as user input is accepted, while with Low Code we could trim the user input.
return vaInputs.enter_comment.getValue().trim() == '';
Dynamic Bot responses
To give the Bot a bit more variety, and because this is a more often used topic, we decided to have some dynamic bot responses. Not that hard to achieve, just add some Low Code to the Response Message.
var conditionStr = Math.floor(Math.random() * 2) + 1;
switch(conditionStr) {
case 1:
return gs.getMessage('Give me a micro sec while I\'ll get you that record.');
break;
default:
return gs.getMessage('Tough cookie, though found it.');
}
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 Check IT Ticket Status topic does offer a solid base to start with. Though, with some slight adjustments, you could enhance the topic greatly!
---
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
---
- 5,355 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi
Thanks for sharing this logic.The image in the summary is not very clear to understand the complete flow.Is it possible to share a clear image or an update set of this enhanced topic please?
Sami
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark,
I'm on the same boat as Sami Siddiqui.
Would be helpful if we had a clear view of the flow.
Thanks,

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi there,
I've added a bigger image as attachment.
Kind regards,
Mark

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi there,
I've added a bigger image as attachment.
Kind regards,
Mark
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I'm including a custom table called u_service_request, and every piece appears to be working as expected (selection of table, building out list, showing record, etc.). At this point, when adding a comment nothing seems to work and I've verified that the custom table does NOT contain any ACLs that would be impacting this. Are there limitations to adding comments from VA? Or potentially just to a custom table?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi
Need some help with 'Exit choice list'. Is the <img> missing there? We have a similar requirement and are currently in Rome and it appears that SN made significant updates to the Check Ticket Status topic to what you've posted. Can you please elaborate on how did you achieve the exit choice list?
Thanks!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks @Mark Roethof great content as always. I'm looking to have end user enter an utterance "I want an update on RITM1043525" which then brings back a card response showing that specific ticket details.
Currenrly, the NLU picks up the utterance and goes into Check IT Ticket Status, but brings back this;
and clicking on 'requested ite,' will bring back the right card. Is there a way to skip this step and show the card itself?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark I raised a query with Service Now Support about this very issue and they put me onto this great thread, so thank you. We are about to implement VA and want to use the Check IT ticket status topic but return Service Requests as opposed to request items. I am struggling to read the overall content on the images on this thread and not sure where to start in updating / adding the updated scripts to the flow in order try out (it is very blurry) but am just wanting to put your solution in if possible , possibly bring in change requests too. I wondered if you had any further information that could help me please?
I'm also conscious this is quite an old thread. Unfortunately there still isn't an OOB topic that includes sc_request.
@Mark Roethof
Thanks,
Nick