Filter discoverable topics based on initial question about Department

Alessandro D_1
Tera Contributor

Hi All,

I'm configuring the Virtual Agent for a client, where they have multiple departments and the number of topics are meant to increase a lot. 

For this reason we thought we could add an initial question, in the customised greetings setup topic, where we basically ask the users the type of support they are looking for (IT, Legal, HR, Facility, etc.).

When they select the department we would then set a variable somewhere (and here begins my issue), so that we can use it in the condition of the various topics, to decide whether they should be discovered or not.

I've tried with a vaVars, vaContext, vaInputs, and I also tried adding a parameter in the session (gs.getSession().putParameter), but it seems that when we try to look for this variable in the scripted condition of our topics, none of those objects are available.

I get errors like:
com.glide.script.RhinoEcmaError: "vaVars" is not defined.
Topic.7b6e9abe1bdf0910b6ec337a9b4bcb0e : Line(2) column(0)

 

Strange is that this issue only happens when the Va is trying to discover a topic with a search from the user. However, in the "Show me everything" selector, the topics are correctly filtered out, or shown when the condition is true.

I'm really struggling with this issue, as I'm not able to narrow down the number of Topics to the users.

Any suggestion on what I'm doing wrong? I've already raised a ticket in ServiceNow and they said it is out of standard support. And professional services, plus other ServiceNow employees, told me the approach is correct i.e. using an initial question to filter out not relevant topics, but I haven't received any feedback on how to achieve that.

 

Thanks
Alessandro

9 REPLIES 9

Muralidharan BS
Mega Sage
Mega Sage

HI Alessandro,

Can you try this, 

In this case, you wanted to span across multiple topics so vaContext is the right one to use. 

1. add a context variable in the chat setup. It should be in this table - sys_cs_virtual_agent_context. Give it a unique name and script var name

find_real_file.png

2. now go to the topics, and add conditions to include the variable. In this case, I have used devicetype variable. use the one you created above. 

find_real_file.png

3. In the greeting topics or your pre-chat survey, ask the first question to the user as - the type of support they are looking for

the answer should be saved in the context like this in the script within this topic. Once done this topic answer can be used in other topics. 

I believe you are going for static choices to present to users, then just add a script card below and update variables. 

find_real_file.png

(function execute() {
    vaContext.LiveAgent_devicetype = vaInputs.type_of_support
})()

 

check the logs by including gs.debug or info to verify the values. 

Thanks

Hi Murali,

thanks a lot for your reply. I had done exactly that at the beginning, and then tried various other options without success.

It is strange because with the configuration you provided, if I look at the Topics in "Show me everything", I can see my test topic is there, meaning it's been discovered and the condition with the context variable works perfectly.

However, if I type my utterances instead of selecting the item from the "Show me everything" options, the VA doesn't find it. 
When debugging it, I tried to print the variable in the script condition, and I get the error saying vaContext is not defined. 

find_real_file.png

 

I also tried with other objects such as vaVars, vaInputs, as well as gs.getSession(), and it always tell me those objects are not defined.

I must be doing something wrong but I can't see what it is.

 

Thanks
Alessandro

 

Hi Alessandro,

Did you find a solution for this?
I am dealing with exact same issue with vaVars/vaContext variable value showing as undefined in Topic (Properties- condition) even though I set the variable value explicitly in the Greeting setup topic. This happens only when invoking the topic via utterances.


Please do share the solution if you have happened to resolve it.

Thanks,
Sushant

Hi Sushant,

unfortunately I haven't resolved it yet. I'm going to have a call with ServiceNow on Monday to discuss this issue and I will let you know if I manage to get a solution.
It is indeed a strange issue, as it only happens when searching with utterances. As I initially wrote I also tried with placing a property in the session, but it looks like that also the GlideSession object shows as undefined.

I will keep you posted.

 

Thanks
Alessandro