- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 07:13 AM
Hi, I copied the out of box Search for knowledge topic. Works fine in returning links for my searches, however the actual link is directing users to the standard interface kb_view.do page. Ideas on where I configure this? Property? I don't see anything in the actual topic or virtual agent settings that I need to configure for this. Odd thing is that this worked fine in New York, directed user to the service portal kb_article page. I cloned and upgraded one of our non prod instances to Orlando and now the user is getting directed to standard interface. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 12:28 PM
I noticed this with the contextual search when we were displaying catalog items. The code below is for catalog items but if you change it around it should work for knowledge base items too.
This is the ootb code for the display kbs link handler.
var linkBuilder = new global.cxs_SearchResultLinkBuilder();
for (var i = index; i < index + limit && i < searchJsonObj.length; i++) {
var link = linkBuilder.build(searchJsonObj[i], vaInputs.portal);
groupedLinksOutMsg.addLinkPart(link.label, link.link, link.description, link.context_label);
}
I changed this to
var linkBuilder = new global.cxs_SearchResultLinkBuilder();
for (var i = index; i < index + limit && i < searchJsonObj.length; i++) {
var link = linkBuilder.build(searchJsonObj[i], vaInputs.portal);
if(link && link.link){
url = link.link;
if(url.includes("cxs_cat_item.do?")){
url = url.replace("cxs_cat_item.do?sysparm_id", "sp?id=sc_cat_item&sys_id");
}
groupedLinksOutMsg.addLinkPart(link.label, url, link.description, link.context_label);
}else{
index++;
}
}
Note that the line url = url.replace is what you would need to change for the knowledge base.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2020 08:08 AM
I changed the "vaInputs.portal" parameter in the linkBuilder to the portal name, seems to do the trick. I couldn't find any reference to vaInputs.portal in the conversation, not sure why its there.
var linkBuilder = new global.cxs_SearchResultLinkBuilder();
for (var i = index; i < index + limit && i < searchJsonObj.length; i++) {
var link = linkBuilder.build(searchJsonObj[i], "sp");
groupedLinksOutMsg.addLinkPart(link.label, link.link, link.description, link.context_label);
}
You can put the portal name in a variable instead of hard coding it in the script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2021 07:51 AM
Hello,
ServiceNow has a Knowledge Article for this topic. - KB0961011 - How to redirect knowledge article link in VA Agent search result to portal instead of na...
I thought this would be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2021 10:41 AM
Good find.
Though, it would be ideal that the portal suffix is not hard-coded.