Virtual agent html bot response i'm not able to add the onclick event

shiva10
Tera Contributor

Hi All,

 

i need to switch topic on click on a text i tried the below code on click event is not triggered

 

<html>
<body>
<script>
function click(){
vaSystem.switchTopic('Contact Live Agent');
}
</script>
<span onclick="click()"
style="color: blue; cursor: pointer">click me </span>
</body>
</html>
8 REPLIES 8

Rachit P
Kilo Contributor

I am facing same issue. Can someone help!

Chris D
Kilo Sage
Kilo Sage

I would say generally avoid using the HTML bot response where possible and look outside it for alternatives if you do run into a problem like this.

Do you need to be using HTML? I'm guessing your example provided is intentionally simpler than your actual use case, but can you work your use case into other bot responses, like a choice list (even if just one choice)? Then you can just use the choice input to feed a Script Response where you can do the topic switch.

 

p.s. I've read in a different post here that the following code is a better alternative to switchTopic():

(function execute() {
    vaVars.global_search_text = 'name of the topic';
    vaSystem.topicDiscovery();
})()

shiva10
Tera Contributor

Hi Chris,

i was looking for onclick event on the greeting message when user clicks on the onclick link contact live agent is to be triggered. 

 

Welcome to the site contact live agent(Link to contact live agent topic)

 

regards,

shiva 

Rachit P
Kilo Contributor

Hi Chris

find_real_file.png

What I am trying to do when user clicks on 'Contact live agent'. He gets topic switched to 'Contact Live Agent' in the same flow in continuation but not able to do it using onclick and anchor tag. Any suggestions?

 

Regards

Rachit