Virtual Agent - Rate their experience topic - ServiceNow Community
Mark Roethof
Tera Patron
Tera Patron

Hi there,

To provide the Virtual Agent with a "rate their experience" option, I've worked on a Chat Satisfaction topic. The idea coming from Surveys, etc. that we are using, as well as the ServiceNow Support video "Virtual Agent Overview" which briefly mentions a "rate their experience" option.
The topic is not 100% there yet, though enough to share!

In short:

At the end of the conversation, the consumer is being presented with a nice carousel. The option selected is written to a new "Chat Satisfaction" table and the conversation is now definitely finished.
A preview of the end result for the Consumer:

find_real_file.png

You might at some point not want the Chat Satisfaction to appear any more or just randomly. To fulfill this, two Script Variables have been set up.
1) chat_satisfaction_level: always / random / none.
2) chat_satisfaction_number: integer which is used in the randomizer.
These Script Variables are easy to edit and a bit like how they are used in out-of-the-box Virtual Agent Topics. Though, you could easily tie these to System Properties and add those System Properties to the Virtual Agent System Properties pages.

At this moment, the follow-up on the Chat Satisfaction is up to you. For example, if the rating is poor, you could add a redirect to a Live Agent, generate an e-mail notification, generate an incident, etc.. Incorporating the results into the - Madrid - dashboard would also be a possibility.

So what has actually been set up?


The big picture:


find_real_file.png


The details:

1) Setting up Script Variables. chat_satisfaction_level in this case "always", topic your topic sys_id, chat_satisfaction_number in this case "5".

find_real_file.png

You could also use System Properties for this. Script to be used in that case would be something like:

(function execute() {
    
    return gs.getProperty('qt_va.chat_satisfaction_level');
    
})()


2)
The transitions after the first Decision Utility are scripted. In case of "always":

(function execute() {
    
    return vaVars.chat_satisfaction_level == 'always';
    
})()


3)
The Script Action Utility script is made of:

(function execute() {
    
    vaVars.randomInt = Math.floor(Math.random() * vaVars.chat_satisfaction_number) + 1;
    
})()


4)
On the Text Bot Response "Thank you", the Response Message is:

Thank you for having a chat with me!


5)
On the Text Bot Response "Chat opinion", the Response Message is:

My colleagues and I are interested in your opinion about our chat.


6)
The Carousel User Input consists of a bit more work.
Prompt would be:

Could you express how you feel about our chat?

Scripted Acknowledge Message would be:

(function execute() {
    
	return gs.getMessage('qt_va_cs_' + vaInputs.chat_satisfaction_survey.getValue());
    
})()

Scripted Carousel Item Setting would be:

(function execute() {

    var options = [];

    var grChoices = new GlideRecord('sys_choice');
    grChoices.addEncodedQuery('inactive=false^name=qt_va_core_chat_satisfaction');
    grChoices._query();

    while(grChoices._next()) {
        options.push(
            {
                'Name': gs.getMessage(grChoices.getValue('label')),
                'Value': grChoices.getValue('value'),
                'Body': 'qt_satisfaction_smile_' + grChoices.getValue('value') + '.jpg'
            }
        );
    }

    return options;

})()


7)
As you can see, in the previous step the sys_choices table is being referenced as well as some JPG images and gs.getMessage
The images are available here: positive / neutral / negative / opinionless.

The sys_choices are on a new custom table. The custom table contains fields:

Topic [Reference, sys_cs_topic]
Rating [Choice]
Consumer [Reference, sys_user]

The choices on Rating being:

Stoked [positive]
Mwah [neutral]
Crook [negative]
**** off [opinionless]

To fulfill the gs.getMessage and Internationalization, add records to the sys_ui_message table for every choice. For example:

find_real_file.png


😎
Field Values for the Action Utility:

find_real_file.png


9)
 On the End Segment Properties, the Confirmation Message is:

Hope to see you soon again.


So why did I mention the topic is not 100% there yet?

1) You have to incorporate the whole Chat Satisfaction in every topic you got! At this moment it's not possible to tie topics to each other, having child topics, etc.. I've opened an enhancement request for this.
2) You can't exit the carousel. As a workaround, I added an extra option (value "opinionless"). I've opened an enhancement request for this.
3) I added a Script Variable "topic" containing the sys_id op the current topic. Somehow the name of the topic should be known, though there is not a vaSystem, vaContext, vaVars, vaInputs, etc. variable that we can use for this. I've opened a Hi ticket for this.

---

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

---

LinkedIn

Comments
Amit45
Tera Expert

Hi Mark, 

I am trying to implement rate experience functionality. 

Have couple of doubts - 

1) I am not able to understand this line - 

grChoices.addEncodedQuery('inactive=false^name=qt_va_core_chat_satisfaction');

In this case, name=qt_va_core_chat_satisfaction is referring to which record?

2) i am getting no record found, i have setup sys_rating table which contains topic, customer and rating as fields. 

is there any other table which i need to create. 

3) can you please explain me this script on Carousel Item - 

(function execute()

{ var options = [];

var grChoices = new GlideRecord('sys_choice');

grChoices.addEncodedQuery('inactive=false^name=qt_va_core_chat_satisfaction'); grChoices._query();

while(grChoices._next()) {

options.push( {

'Name': gs.getMessage(grChoices.getValue('label')), 'Value': grChoices.getValue('value'), 'Body': 'qt_satisfaction_smile_' + grChoices.getValue('value') + '.jpg'

} ); }

return options;

})()

 

How to setup jpg image in the script?

Kind Regards,

Amit

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Good questions! Let me add how the chat satisfaction table looks like. I made it in a scoped app, though you could also use global off course.

find_real_file.png

And the choices for the Rating field.

find_real_file.png

The values of these choices are actually also used in the naming of the icons which are stored in the images table.
1) qt_satisfaction_smile_positive.jpg 
2) qt_satisfaction_smile_neutral.jpg
3) qt_satisfaction_smile_negative.jpg
4) qt_satisfaction_smile_opinionless.jpg

Kind regards,
Mark

---

LinkedIn

Simon H
Kilo Sage

Mark,

 I don't know if it would help, but I found a way you can change topics with a script, this would allow you to redirect to one "user experience" topic at the end of each topic, I posted the article below:

Virtual Agent - How to switch Topics

 

Mark Roethof
Tera Patron
Tera Patron

Hi Simon,

Great finding! I will use this in my topics and future articles, very nicely done!

Kind regards,
Mark

---

LinkedIn

Venkateswarlu K
Mega Guru

@Mark Roethof I have a question for you can we send a mail to the user  after complete conversation with chat??

 

Like what chat provided what they asked is this possible?? if yes please let me know how can we get it.

 

 

Regards,

Venkat.

 

 

 
Version history
Last update:
‎03-17-2019 07:09 AM
Updated by: