logo

NJP

Hiding topics from the Virtual Agent Topic Picker

Import · Sep 01, 2019 · article

Hi there,

When working with the vaSystem.switchTopic() variable within the Virtual Agent, you could dynamically switch to other topics. A great finding described in this article by Simon H: Virtual Agent - How to switch Topics. You might for example switch to a Survey topic, a generic End topic, a topic which by default should be hidden, etc.. Though, those topics will appear in the out-of-the-box Topic Picker.

While searching for a solution, I was struggling a bit. What could be check for, what is the current topic, how to define the start of the conversation. Though actually, there's a very very very simple and effective solution for this! Describing it below.

Also noticed this is useful when you are working with System Topics in New York. Not all topics for example have a condition on the Topic Properties, therefor for example the "Greetings" topic would appear in the Topic Picker if it's active and not set as a Setup Topic.

The issue

We've setup a "Chat Satisfaction" topic as a survey mechanism. This topic should only be visible if it's addressed thru the vaSystem.switchTopic() variable. Though, by default this topic will also appear in the topic picker.

image

Topic Properties

Within the Topic Properties, there are several options to limit who can see the topic or when the topic should be available.

image

Using the Condition

Quite simple, but very effective, you could just add a condition on the Topic Properties. For making a Topic not visible anymore, you could just add "return false"!!! The topic will not be shown in the default Topic anymore, though will still be available when addressed thru the vaSystem.switchTopic() variable. This last bit is import ofcourse, while setting up a condition for hiding the topic from the topic picker, this could lead to not being able to switch to that topic at all. With just using "return false", no issues at all.

This could also be applied on some of the new out-of-the-box New York topics which somehow don't have a condition.

(function execute() {

    return false;

})()

And that's actually it!

End result

The Topic Picker looks a bit cleaner and doesn't show the "Chat Satisfaction" topic.

image

If addressed thru the vaSystem.switchTopic() variable, the topic is still available.

image

New York sneak preview

As mentioned, when you are working with System Topics in New York, not all topics got a condition on the Topic Properties. Therefor for example the "Greetings" topic would appear in the Topic Picker if it's active and not set as a Setup Topic. Applying the solution described above would fix this issue.

image

---

And that's it actually. Not much too it.

image 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

Labels:

image

View original source

https://www.servicenow.com/community/virtual-agent-nlu-articles/hiding-topics-from-the-virtual-agent-topic-picker/ta-p/2314054