Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to switch Topics using topicDiscovery()

Vishal Sharma3
Tera Contributor

I am using switchtopic() to switch topics but When I use this function, Option to start a new conversation is not coming in virtual agent. See below image: 

 

find_real_file.png

 

Now, I want to use topicDiscovery() to switch the Topics but I do not know the exact syntax and procedure to use the same. Can anyone please help me that how do we use topicDiscovery() to switch to specific topics?

@Mark Roethof 

1 ACCEPTED SOLUTION

Basically it's just what's mentioned in this article:
50+ (Un)documented Virtual Agent variables (vaInputs, vaVars, vaContext, vaSystem)

Or just example script:

(function execute() {

    vaVars.global_search_text = 'Topic Name to Switch to';
    vaSystem.topicDiscovery();

})()

Be aware: Name of the topic, not sys_id!

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

7 REPLIES 7

tarek_elkelani
ServiceNow Employee
ServiceNow Employee

Hello, 

I believe it is
vaSystem.switchTopic(vaVars._setup_explore_help_topic);​

The OOB behavior of the Anything Else Topic will start a new conversation when you answer "Yes" to the "Is there anything else I can assist you with?"

Thank you

@tarek.elkelani 

Hi, I want to know the syntax of topicDiscovery().

Vishal Sharma3
Tera Contributor

@Mark Roethof Can you please add your input here if anything.

Sure will look into it shortly!

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn