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

Hi Alessandro,

Wanted to check if you were able to resolve this issue. Let me know if you found anything helpful.

Thanks,
Sushant 

Hi @Alessandro D_1 , 

Did you get a Workaround of this situation on your ServiceNow call? Or did you explore a different way to handle the situation? I'm facing the same issue.

 

VictorGuzman_0-1700772410374.png

 

vaVars is not defined when debugging.

Hi Alessandro 

 

Did you find a solution to this problem?

I am also having the same issue, only vaVars works when dynamically defined in Greetings.

In topic Context script getting vaVar is valid, topic accessibility in topic picker also works, however  if go through NLU topic applicability check will return vaVar not found.

I assume the issue is the Evaluator is in backend / other programming scope which cannot access vaVars object, so I did a try/catch to workaround.

 

    var department = 'XXXX';

    var user_department = '';

    try {        // GlideRecord will not work for Topic Picker (show me everything)
        // I stored the input user department to Context Variable user_department at Greeting Setup Topic
        user_department = vaVars.LiveAgent_user_department;
    } catch (ex) {        // Topic Evaluator cannot access vaVars, so do GlideRecord for the Context Variable
        var interaction_id = vaSystem.getInteractionSysId();
        var gr = new GlideRecord('interaction');
        gr.get(interaction_id);
        user_department = gr.context.u_liveagent_user_department;
    }

    if (user_department == department) {
        return true;
    }
    else {
        return false;
    }