- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2020 06:42 AM
I've been working on setting up Agent Workspace Chat in ServiceNow and I am using the "Greeting Topic" in Virtual Agent to gather some information from the user that I would like to pass to a Live Agent.
From what I can tell the chat "Context" are what you are supposed to use for this, but the only useful OOB Context is "Short Description" for us so we would like to add more. I created another Context for a field we use called "u_call_back_number" on our Incident form. The context I created looks like this:
I've experimented with adding a table or a value but that causes errors when transferring to a Live Agent. I can't seem to find any documentation about this either.
Here is the VA code I'm using to pass the variables:
vaVars.LiveAgent_short_description = vaInputs.short_description_help_desk;
vaVars.LiveAgent_u_call_back_number = vaInputs.phone;
The Short Description is working fine, but my goal is to get the "LiveAgent_u_call_back_number" variable set to the "u_call_back_number" field on our Incident form. Does anyone have any pointers for me?
Solved! Go to Solution.
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 10:39 AM
For those of you who are interested I found a solution for this:
In order to get access to the Live Agent Variables (Contexts) for an Interactions you just need to know it's sys_id then you can use the "context_table" and "context_document" values on the Interaction for that information.
So an example of this on Incident would be:
var interaction = current.parent_interaction
var contextTable = interaction.getValue('context_table');
var interactionBlobRecord = new GlideRecord(contextTable);
interactionBlobRecord.addQuery('sys_id', interaction.getValue('context_document'));
interactionBlobRecord.query();
if (interactionBlobRecord.next()) {
var jsonBlob = JSON.parse(interactionBlobRecord.getValue('value'));
if (jsonBlob.liveagent_u_assignment_group) {
current.setValue('u_assignment_group', jsonBlob.liveagent_u_assignment_group);
}
}
In this example you would need to setup a field called "parent_interaction" and have it populated with the desired Interaction record, then you can use any of the Virtual Agent context information in your ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 09:26 AM
Try to take the details which you are looking for from as"user input". Then use the dot walking as you have used in your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 10:39 AM
For those of you who are interested I found a solution for this:
In order to get access to the Live Agent Variables (Contexts) for an Interactions you just need to know it's sys_id then you can use the "context_table" and "context_document" values on the Interaction for that information.
So an example of this on Incident would be:
var interaction = current.parent_interaction
var contextTable = interaction.getValue('context_table');
var interactionBlobRecord = new GlideRecord(contextTable);
interactionBlobRecord.addQuery('sys_id', interaction.getValue('context_document'));
interactionBlobRecord.query();
if (interactionBlobRecord.next()) {
var jsonBlob = JSON.parse(interactionBlobRecord.getValue('value'));
if (jsonBlob.liveagent_u_assignment_group) {
current.setValue('u_assignment_group', jsonBlob.liveagent_u_assignment_group);
}
}
In this example you would need to setup a field called "parent_interaction" and have it populated with the desired Interaction record, then you can use any of the Virtual Agent context information in your ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 09:31 AM
Hello, Could you please explain this solution. I dont see this table in my instance or in sys_db_object?
var interactionBlobRecord = new GlideRecord(contextTable);
Tables i see is - v_interaction_context, sys_cs_virtual_agent_context
I want to know where is the logic which initializes the interaction record and how the mapping works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 11:03 AM
On the Interaction table there are two hidden fields that link you to the Context table for that Interaction and the ID of the Context record for that Interaction. They are:
- interaction.context_table
- interaction.context_document
You'll notice in the code I provided I define a variable "contextTable" to the value of interaction.context_table, generally this is the "interaction_json_blob" table which returns an JSON object containing all the context info for you to then parse.