In Virtual Agent, how can I script the "Exit full topic list" ?

JLeong
Mega Sage

Hi Guys,

I have a requirement to add a Back button at the end of the topic list. So when a user reaches the end of the topic list, there is an option to click back:

find_real_file.png

I created a small topic:

find_real_file.png

 

find_real_file.png

 

For some reason when I use the Back option and then ask questions, the NLU doesn't work. I get the "Is there anything else I can assist you with?" right away instead of looking for a topic or a KB article.

find_real_file.png

Thanks in advance.

 

 

1 ACCEPTED SOLUTION

IC2
Tera Expert

Hi JLeong,

The first thing I would recommend is to use the out of the box back button available in the Virtual Agent window. This way you avoid unexpected behaviour when developing a back button option yourself.

find_real_file.png

If this is not a valid solution, you could try adding the following to your Topic:

Before your "Back to Discovery" script action, add a "reset topic script" with the following code:

find_real_file.png

(function execute() {
    vaVars._topic_current = null;
})()

This should reset the conversation and stop the flow from continuing to the "anything else topic".

Let me know if it helps,

Kind regards,

View solution in original post

6 REPLIES 6

IC2
Tera Expert

Hi JLeong,

The first thing I would recommend is to use the out of the box back button available in the Virtual Agent window. This way you avoid unexpected behaviour when developing a back button option yourself.

find_real_file.png

If this is not a valid solution, you could try adding the following to your Topic:

Before your "Back to Discovery" script action, add a "reset topic script" with the following code:

find_real_file.png

(function execute() {
    vaVars._topic_current = null;
})()

This should reset the conversation and stop the flow from continuing to the "anything else topic".

Let me know if it helps,

Kind regards,

Andy Lilly
Tera Expert

I agree with IC. You need to set the current topic to Null. I would also recommend using switchtopic instead of sendtopicpickercontrol I have multiple back buttons which work really well with this .

 

(function execute() {
vaVars._topic_current = null;
var greetingMessage = vaSystem.getTopicSelectionMessage();
vaSystem.sendTopicPickerControl(greetingMessage);
})()
 
Can I ask how you got the back arrow to show on your back button please?

(function execute() {
vaSystem.switchTopic('TOPIC NAME');
})()

Thanks, Andy! I will try this solution.

For the arrow back, I used the ASCII character - alt 27, try that (←)