
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 09-01-2019 01:41 AM
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.
Topic Properties
Within the Topic Properties, there are several options to limit who can see the topic or when the topic should be available.
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.
If addressed thru the vaSystem.switchTopic() variable, the topic is still available.
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.
---
And that's it actually. Not much too it.
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
---
- 4,868 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark,
We have some topics we'd like to hide from the topic list. We used the condition to set it to false. But when I enter a phrase from my NLU model to call the hidden topic, it doesn't recognize the topic.
We are also shareing the VA with another department, so our condition looks like this:

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Yasmin,
Don't understand your question about VA and another department. The script you pasted is more likely for multiple portals? Can you open a new Community question for this and add details on how you are using VA for multiple portals, how you distinguish this, etc..
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Sure. I can open another question. What I mean is that another dept is also using VA in their own portal. As you know VA in NY is shared, we cannot have separate branding, we share the setup topics, etc...

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hides it from the "show me everything" but is still available via the NLU search.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Mark
Is there any way to hide OOTB topic?
because in Rome there is a OOTB topic " Pulse Survey " and I am unable to hide that topic from Topic Picker.
Thanks in Advance

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Have you tried deactivating that topic or removing it from the topic list:
Hide topics to be Discoverable via keywords or NLU / Remove topics under "Show me everything" [Rome]
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Yes I tried to Deactivate topic as well as tried to deactivate "Include in List of topics" but whenever I click on publish and after reloading the page the changes were reverted to active.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hello Mark your solution is not working to hide and shoe topics
i have to show topic in sp portal and hide on from other i have gone through with your all documents and solution with script condition but no any luck get just i want to give solution here because i have seen you are the legend
thanks