Clicking on Topic should redirect to a hyperlink in Virtual Assistance

SAS21
Tera Guru

I have Created a Topic 'Show Process' in the Virtual Assistance but it shows in 'Show me everything' but not in the Bot. Requirement is if a user clicks on 'Show Process' topic it should redirect to a hyperlink. If user doesnt click also it should redirect automatically say after 40sec. 

 

How to achieve this . Appreciate the Help!

 

Thank you

1 ACCEPTED SOLUTION

Hi @SAS21  

if it solved your issue please mark as solution accepted that help me to groww

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

3 REPLIES 3

Ravi Gaurav
Giga Sage
Giga Sage

Hi Bhavana,

To achieve this in ServiceNow, you can use a combination of Virtual Agent (VA) and a custom script. Here's a step-by-step guide:

Step 1: Create a new topic in Virtual Agent

  • Go to Virtual Agent > Topics and create a new topic called "Show Process".
  • In the topic, add a message that will be displayed to the user, e.g., "Click here to view the process".

Step 2: Add a hyperlink to the topic

  • In the topic, click on the "Add Action" button and select "Open URL".
  • Enter the URL you want to redirect the user to.
  • Save the topic.

Step 3: Create a custom script to redirect the user automatically

  • Go to System Definition > Scripts and create a new script.
  • Name the script, e.g., "Redirect to Process".
  • In the script, add the following code:

    // Get the current conversation
    var conversation = new GlideConversation();

    // Check if the conversation is active
    if (conversation.isActive()) {
    // Get the topic
    var topic = conversation.getTopic();

    // Check if the topic is "Show Process"
    if (topic.getName() == "Show Process") {
    // Redirect the user to the URL after 40 seconds
    setTimeout(function() {
    conversation.redirect("https://your-url.com");
    }, 40000);
    }
    }

  • Replace https://your-url.com with the actual URL you want to redirect the user to.

    Step 4: Add the script to the Virtual Agent

    • Go to Virtual Agent > Configuration and click on the "Scripts" tab.
    • Click on the "Add Script" button and select the script you created in Step 3.
    • Save the changes.

    Step 5: Test the topic

    • Go to the Virtual Agent and start a new conversation.
    • Click on the "Show Process" topic.
    • The user should be redirected to the URL after 40 seconds.

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Hi @SAS21  

if it solved your issue please mark as solution accepted that help me to groww

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Hello Ravi

 

Any idea on how to change the layout for the topics in the Virtual Assistance? After upgrade to Washington layout of the topics changed to List. It was like Tiles before upgrade.

 

Thank you,

Bhavana