How do I switch to part way through another topic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-17-2021 05:25 AM
I have a need to switch topics half way through a topic but I don't want to go back to the start of the topic I am switching to and have to ask the user the same questions again, is there any way to switch topic and start the topic part way down?
Below is the code I'm currently using to switch topics which takes me back to the start of a topic:
(function execute() {
vaSystem.switchTopic('/*topic name*/')
})()
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-17-2021 05:42 AM
I dont think you can switch into middle of a topic, instead you can use topic block to reuse the topics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-17-2021 06:16 AM
As per a different post, apparently using switchTopic() will prevent the user from manually ending the conversation (or switching back to the original) and you can/should use the following instead:
(function execute() {
vaVars.global_search_text = 'name of the topic';
vaSystem.topicDiscovery();
})()
With this in mind, you may be able to take advantage of NLU + entity extraction to do what you want. Granted, I haven't tried - I've only switched topics by providing the exact topic name - but presuming this topicDiscovery() method does an NLU call (like the original user input), if you feed it a phrase that is certain to match your desired topic (exact name might be fine) plus an entity, you can use that entity to bypass certain input on your second topic (as long as your NLU intent and that topic are configured for entities). If you're talking multiple inputs on the second topic, this might not work.
Now that I think about it, here's another - much better - option I'm more confident in (because I've done something similar): add branching logic to the start of your second topic. With that conditional logic, you want to query the conversation_task table and check if the topic of the preceding (noted by their matching conversation) conversation_task matches the topic(s) you want. What I show below is how it works in my Feedback/Survey topic, which allows me to avoid giving users a survey if they use certain topics.
(function execute() {
//don't skip the survey for users who used VA to do anything but clear a Citrix session
//or Survey (preventing a redundant survey)
var gr = new GlideRecord('sys_cs_conversation_task');
//look for all topics (conversation tasks) within this same conversation
gr.addQuery('conversation', vaVars.global_vCurrentTopicId);
//look specifically for Citrix Application Frozen/Not Launching
//or Survey
gr.addQuery('topic_type','044b7315dbbb081026a61fdc139619a3').addOrCondition('topic_type','26baac293b77330074bc456993efc4dd');
gr.query();
if (gr.next()){
return true;
}
else {
return false;
}
})()