Virtual agent interactions

Community Alums
Not applicable

Hi all,

 

Does anyone know how virtual agents interaction records get created after a conversation?

and if so, how to populate other fields of the interaction record depending on the conversation? 

Thanks

1 ACCEPTED SOLUTION

Chris D
Kilo Sage
Kilo Sage

I'm not sure if we have access to how Interactions are created by VA conversations, but it's irrelevant to the second question...

You can update the interaction record via a normal GlideRecord query by getting vaVars._interaction_record_sysid in a script, such as this:

var interaction = new GlideRecord('interaction');
interaction.get(vaVars._interaction_record_sysid);
interaction.short_description = vaInputs.short_description;
interaction.any_other_field = any_other_value;
interaction.update();

 I have this in a topic block myself and would recommend you consider that design as well for reusability.

View solution in original post

5 REPLIES 5

Chris D
Kilo Sage
Kilo Sage

I'm not sure if we have access to how Interactions are created by VA conversations, but it's irrelevant to the second question...

You can update the interaction record via a normal GlideRecord query by getting vaVars._interaction_record_sysid in a script, such as this:

var interaction = new GlideRecord('interaction');
interaction.get(vaVars._interaction_record_sysid);
interaction.short_description = vaInputs.short_description;
interaction.any_other_field = any_other_value;
interaction.update();

 I have this in a topic block myself and would recommend you consider that design as well for reusability.

Lynda1
Kilo Sage

The interaction record is created at the start of a conversation. As Chris stated, Short Description is our go to field to update with the conversation information when it transfers to live chat. I have the below code in every conversation that goes to live chat so I can control what is put in the Short Description. of course the variable name is different in the topics.

 

This is using a variable that is within the Topic:

 

(function execute() {
vaVars.LiveAgent_short_description = vaInputs.common_issues;
vaVars.LiveAgent_application = 'itsm';
})()
 
If I do not have a variable to use I just replace the variable with "what I want it to say" 

Community Alums
Not applicable

Hi @Lynda1 @Chris D 

so for these field on the interaction record I highlighted below in the screenshot

Dev86_0-1724060619045.png

To access and and populate the fields, should I create a script action at the end of the topic?

and then write a code like this: 

(function execute() {
vaVars.LiveAgent_account = vaInputs.account_number;
vaVars.LiveAgent_contact = vaInputs.username;
})()

 

Yes, it will be in a script action - though as I mentioned, for reusability, I recommend doing this in a topic block instead of the topic. 

But no, the code will not look like that. Lynda's mention of the Short Description Live Agent variable was slightly deceiving - I did not mention it to keep things simple. The Short Description Live Agent variable is unique because it's one (possibly the only one) where the system copies its value into the Interaction record. I'm not sure of how/where it does this. (Note it appears there's an ootb "Interaction_Account" Live Agent variable which may do the same thing but I'm not sure.)

 

You can create all the Live Agent variable you'd like, but I do not think they are going to help your case here where you want to update multiple interaction fields - the system would not have them mapped to the corresponding interaction fields like it does with Short Description.

 

Go look at my code example I shared earlier - you can do it easily with a GlideRecord query - there's no need to involve Live Agent variables.