- 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-24-2019 04:01 PM
Is kb_article_view an OOB page? Because I can't find it. It may be a custom one created by your team.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 04:38 PM
Yes, it comes with the Knowledge Management - Service Portal plugin.
Susan Williams, Lexmark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 09:40 PM
Hi Susan,
Refer to this blog. Please mark it helpful if that solved your purpose.
https://community.servicenow.com/community?id=community_blog&sys_id=de5ce6a1dbd0dbc01dcaf3231f96194a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 10:45 PM
Yes, I've read both of those blogs before.
The Typeahead tab on our Knowledge Base search source is very similar to the OOB one except we selected a different glyph and are using the kb_article_view page.
But nowhere do I see how to update which URL is used when clicking a result in the typeahead search results list. It doesn't seem this is something to be done with the Advanced typeahead config either. I am looking at the OOB one for the Service Catalog search source and just see formatting.
Where is the URL defined for typeahead search? I'm hoping this is something simple I am missing.
Susan Williams, Lexmark