Knowledge Bases Browse Widget: Change the page users are sent to

Edwin Fuller
Tera Guru

When clicking a knowledge base from the kb_home page. The "Knowledge Bases Browse" widget takes users to the "kb_search" page, I want to take them to the "kb_category" page for the selected knowledge base.

 

I've copied the "Knowledge Bases Browse" widget already, so how can I accomplish this ask?

 

EdwinFuller_0-1692394941317.png

 

2 REPLIES 2

Sagar Pagar
Tera Patron

Hi @Edwin Fuller,

 

You need to clone the "knowledge Homepage Search [kb-homepage-search] widgets and update the page id in client controller.

 

Client controller:

c.submitSearch = function() {
if(!((!c.data.allow_empty_search && c.keyword == "") || (c.keyword && c.keyword.length < c.data.min_search_char))) {
var url= $location.search({
id: 'kb_category',
query: c.keyword
});

spAriaFocusManager.navigateToLink(url.url());
}
else if(c.keyword && c.keyword.length < c.data.min_search_char)
spUtil.addInfoMessage(c.data.messages.MIN_CHARS_REQUIRED);
};

 


If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

ronyaac
Tera Contributor

Hi I was trying to do the same thing, I cloned the widget and replaced the line item in the Body HTML template: <a href="?id=kb_search&kb_knowledge_base={{::item.sys_id}}" aria-label="${{{::c.getKBLabel(item.title,item.article_count,item.questions_count,item.enable_socialqa)}}}"> 

 

to 

 

<a href="?kb_id={{::item.sys_id}}&id=YOUR KB HOME PAGE" aria-label="${{{::c.getKBLabel(item.title,item.article_count,item.questions_count,item.enable_socialqa)}}}">

 

Replace where it says YOUR VIEW to the knowledge homepage (kb_knowledge_page). Hope that helps, it's working for me so far!