Use a different page than kb_article for a certain knowledge base

markalpine
Kilo Expert

Currently our system uses kb_article for viewing all knowledge basses from the service portal. I have duplicated this page and made some minor changes to the appearance of the copied page. How can get this page to be used whenever a certain Knowledge base is viewed? IE: I don't want it applied to ALL knowledge bases just the one when being viewed form the service portal.

Thanks

1 ACCEPTED SOLUTION

Barrilito van D
Kilo Guru

Hi,

In your navigator go to: Service Portal > Portals... and select your portal.

In your portal now select your search source which you want to change and change the search page template. In one of the first lines you see the href that links to kb_article, change it to the page you desire.

Regards

View solution in original post

6 REPLIES 6

markalpine
Kilo Expert

Can someone at least confirm this is NOT possible?

 

 

Thank you...

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

I did this by adjusting the search source which is utilized by the default SP search.  Search sources are not utilized by the Knowledge Portal so unsure where you are wanting this functionality.

To get started we need a place to designate which portal page to use for KB articles.  I added a reference field to the Knowledgebase table called SP Page which is a reference to the Page (sp_page) table.  This value will be utilized to know which page to direct the user to upon a click.

In the Knowledge Base search source, the Search page template is what is creating the template for each article found while setting the "id" of the page to use when it is clicked.  I adjusted it to use a variable for the ID on the second line below since it was hard coded to kb_article:

<div>
  <a href="?id={{item.display_page}}&amp;sys_id={{item.sys_id}}" class="h4 text-primary m-b-sm block">
    <i class="fa fa-book m-r-sm"></i>
    <span ng-bind-html="highlight(item.short_description, data.q)"></span></a>
  <p ng-bind-html="highlight(item.text, data.q)"></p>
  <span class="text-muted">${Article}: {{item.number}}</span>
  <span class="text-muted">
    <span class="m-l-xs m-r-xs" aria-hidden="true"> &middot; </span>
    ${Published}: <sn-day-ago date="item.publishedUTC"/>
  </span>
</div>

Then in the Data fetch script, I established the value of the "display_page" variable by adding this line before results.push():

article.display_page = kb.kb_knowledge_base.u_sp_page.getDisplayValue();
results.push(article);
kbCount++;

This does require that you set the SP page value on all knowledge bases.  You could adjust the data fetch script to default to "kb_article" if one is not set.  Hope this helps.

 

Please mark this post as helpful or the correct answer to your question if applicable so others viewing may benefit.

Barrilito van D
Kilo Guru

Hi,

In your navigator go to: Service Portal > Portals... and select your portal.

In your portal now select your search source which you want to change and change the search page template. In one of the first lines you see the href that links to kb_article, change it to the page you desire.

Regards

markalpine
Kilo Expert

Thanks for the great answers.

 

The suggestion from barrilitovandijk seems much easier to accomplish.

 

 
 
 

  7h ago