The CreatorCon Call for Content is officially open! Get started here.

How to show specific KB Article on Virtual Agent Chat Bot

JRY
Mega Guru

Hello Team,

I'm new to virtual agent, and I'm attempting to display a certain KB Article when we search using Keywords that we put to the Topic Properties. I'm not sure how to make a show flow. I tried a few things, but none of them worked. I'm having trouble with the flow. Can somebody assist me?

find_real_file.png

find_real_file.png

 

Below are the scripts which I have written 

Get KB Articles(Script Action)

var getKBArticle = new GlideRecord('kb_knowledge');
getKBArticle.get('number', vaInputs.article_number.getValue());

var description = getKBArticle.getValue('text').replace(/(<([^>]+)>)/gi, "");
if(description.length > 80) {
description = description.slice(0, 78) + '...';
}

vaVars.short_description = getKBArticle.getValue('short_description');
vaVars.description = description;

Get KB Articles(HTML)

<html>
<body>
<p><ahref="/kb_view.do?sysparm_article={{vaInputs.article_number}}"target="_blank">{{vaVars.short_description}}</a></p>
<p>{{vaVars.description}}</p>
</body>
</html>
 
Show Topics(Script Action)
 
(function execute() {
vaSystem.switchTopic(vaVars._setup_explore_help_topic);
})()
 
Please help what needs to be change.
 
Thanks,
JRY

 

1 ACCEPTED SOLUTION

Chaitanya Redd1
Tera Guru

Hi,

Can you try to below steps

  1. Duplicate Topic in Virtual Agent Designer "Search Knowledge Base".
  2. Clone Search Context "Knowledge Search" like below Image

find_real_file.png

 

  3. Go to Related list "Resource Configurations" open record created with name "Knowledge"

  4. In the Resource Configuration go to Related list you will find "Condition" record and set value 

find_real_file.png

 

Add SYSID of Knowledge Base as shown below

find_real_file.png

 

  5. Go to the topic which you cloned/ duplicated you will find Script Variable "search_context_sys_id"  as shown below add SYS ID of Search Context which you created in Default value field.

 

find_real_file.png

 

Then Publish it and try to test it will work.

 

Thanks,

Chaitanya

 

View solution in original post

9 REPLIES 9

Mark Roethof
Tera Patron
Tera Patron

Hi there,

"I tried a few things, but none of them worked. I'm having trouble with the flow."

What exactly is not working?

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

Hi Mark,

As you can see in the image below, I attempted to test one of the keywords and received an error. Could you please assist me in resolving this issue?

I'm trying to get the corresponding KB Article link to appear when I search with keywords, but it's not working. KB Article has the same meta tags and name, but it's showing a different issue.

 

find_real_file.png

Thanks

JRY

Hi Mark, 

I've inserted all intents and entities with the new model, but it still appears to be stuck at the Greeting Message step. Could you please tell me what went wrong?

Thanks

JRY

I have tried so many changes still I'm getting error below

find_real_file.png

find_real_file.png

 

find_real_file.png