- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 03:52 PM
We're using typeahead search for knowledge articles but want to display those using the kb_article_view page. After the London upgrade, we are seeing that our typeahead search results for knowledge articles are using the same URL format...
https://instance-name.service-now.com/sp?id=kb_article_view&sys_id=6dbe8137db8f678024f0f6e9af961979
but the kb_article_view page isn't able to handle the sys_id parameter, so we are getting a "Knowledge record not found" message. We need to be using the sys_kb_id parameter instead of sys_id.
We're using the OOB Knowledge Article Content widget on that page. In my personal developer instance, I was able to trick the widget into using the sys_id parameter if it can't find a sy_kb_id parameter. I replaced line 224 of the server script with this code:
data.params.sys_kb_id = $sp.getParameter('sys_kb_id');
data.params.sys_id = $sp.getParameter('sys_id');
if((data.params.sys_id != '' && data.params.sys_id != null) && (data.params.sys_kb_id === '' || data.params.sys_kb_id === null))
data.params.sys_kb_id = data.params.sys_id;
(Please don't judge my code; I'm not much of a script-er.)
It seems the OOB widget should be able to handle either parameter. Anyway, our problem still remains that we don't see a way to change which parameter is used by the search results returned during a typeahead search. It's always using sys_id. Any suggestions on how this can be done?
Susan Williams, Lexmark
Solved! Go to Solution.
- Labels:
-
Knowledge Management
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 10:45 AM
I found an article in the London docs that explains how to do this but there is an error in their code, which I have reported via feedback.
It looks like the London article (didn't check any other version) on the ServiceNow docs site has an incorrect value being used for the sys_kb_id value in the article URL.
In step 1-c, the code should be this:
article.url = "?id=kb_article_view&sys_kb_id=" + article.sys_id;
instead of this:
article.url = '?id=kb_article_view&sys_kb_id=' + kb.sys_id;
In summary, here's what I did to get this to work:
1. Updated the Search page template as Mark suggested above, because we want both the typeahead search and the regular search results to use the kb_article_view page...
<a href="?id=kb_article_view&sys_kb_id={{item.sys_id}}" class="h4 text-primary m-b-sm block">
2. Updated the Data fetch script as mentioned in the docs article but corrected it to article.sys_id...
article.url = "?id=kb_article_view&sys_kb_id=" + article.sys_id;
3. Updated the Page on the Typeahead tab to kb_article_view. This is not required but we want to have it shown there as a visual reminder that we are using the kb_article_view page instead of kb_article.
Susan Williams, Lexmark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 10:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 10:45 AM
I found an article in the London docs that explains how to do this but there is an error in their code, which I have reported via feedback.
It looks like the London article (didn't check any other version) on the ServiceNow docs site has an incorrect value being used for the sys_kb_id value in the article URL.
In step 1-c, the code should be this:
article.url = "?id=kb_article_view&sys_kb_id=" + article.sys_id;
instead of this:
article.url = '?id=kb_article_view&sys_kb_id=' + kb.sys_id;
In summary, here's what I did to get this to work:
1. Updated the Search page template as Mark suggested above, because we want both the typeahead search and the regular search results to use the kb_article_view page...
<a href="?id=kb_article_view&sys_kb_id={{item.sys_id}}" class="h4 text-primary m-b-sm block">
2. Updated the Data fetch script as mentioned in the docs article but corrected it to article.sys_id...
article.url = "?id=kb_article_view&sys_kb_id=" + article.sys_id;
3. Updated the Page on the Typeahead tab to kb_article_view. This is not required but we want to have it shown there as a visual reminder that we are using the kb_article_view page instead of kb_article.
Susan Williams, Lexmark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 02:58 AM
Hi Susan,
I'm new to using servicenow portal, could you give me advise.
My current requirement to include the Knowledge Base selected after doing portal search.
If I've already selected a specific Knowledge Base, my expected search result should only be within that knowledge base.
Any inputs would be much appreciated.
Thanks!