Service Portal Knowledge articles created using kb article templates are not displaying correctly in portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 12:42 PM
Hello,
I am currently working on the ServiceNow Portal and linking the Knowledge Base to the Portal. The knowledge base is linked and everything is working fine except when viewing articles created from the KB templates. When going into the view from the Portal, it only shows the short description, author, view count, and date. It does not show the Articles details at all. But in ServiceNow, it shows all the details. Please see attached screenshots:
Here is my code within the server script:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
var t = data;
data.kb_knowledge_page = $sp.getDisplayValue("kb_knowledge_page") || "kb_view";
var articleGR = GlideRecord("kb_knowledge");
articleGR.get($sp.getParameter('sys_id'));
var recordIsValid = articleGR.isValidRecord();
var canReadArticle = articleGR.canRead();
t.isvalid = recordIsValid && canReadArticle;
if (canReadArticle) {
articleGR.incrementViewCount(); // update sys_view_count immediately on kb_knowledge record
var art = new GlideRecord("kb_use");
if (art.isValid()) {
art.article = articleGR.getUniqueValue();
art.user = gs.getUserID();
art.viewed = true;
art.insert(); // kb_use records are aggregated to update sys_view_count nightly
$sp.logStat('KB Article View', "kb_knowledge", articleGR.getUniqueValue(), articleGR.short_description);
}
t.category = articleGR.getValue('kb_category');
t.sys_id = $sp.getParameter('sys_id');
t.showAttachments = false;
if (articleGR.display_attachments)
t.showAttachments = true;
t.categoryDisplay = articleGR.getDisplayValue('kb_category');
t.short_description = articleGR.getValue('short_description');
if (articleGR.getValue('article_type') == 'wiki')
t.text = GlideWikiModel().render(articleGR.getValue('wiki'));
else
t.text = articleGR.getValue('text');
t.sys_view_count = articleGR.getDisplayValue('sys_view_count');
t.author = articleGR.getDisplayValue('author');
t.publishedUtc = articleGR.getValue('published');
t.number = articleGR.getValue('number');
if (showStarRating())
t.rating = articleGR.getValue('rating');
t.direct = false;
if (articleGR.direct)
t.direct = true;
t.breadcrumbs = [{label: t.short_description, url: '#'}];
if (!articleGR.kb_category.nil()) {
var rec = articleGR.kb_category.getRefRecord();
while (rec.getRecordClassName() == "kb_category") {
t.breadcrumbs.unshift({label: rec.getDisplayValue(), url: '?id=kb_category&kb_category=' + rec.getUniqueValue()});
rec = rec.parent_id.getRefRecord();
}
}
t.breadcrumbs.unshift({label: gs.getMessage("Knowledge Base"), url: '?id=' + t.kb_knowledge_page});
}
function showStarRating() {
if (options.show_star_rating == "Yes")
return true;
if (options.show_star_rating == "No")
return false;
if (gs.getProperty("glide.knowman.show_star_rating", "true") != "true")
return false;
return gs.hasRole(gs.getProperty("glide.knowman.show_star_rating.roles"));
}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Can someone please advise on if I need to add anything additional to the code or perform a workaround?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 06:55 AM
I'm having the exact same issue. Did you ever get a resolution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 07:35 AM
Unfortunately not. Still testing but using only standard templates as a workaround for the time being as they are working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 07:40 AM
I also noticed the 'Show Workflow' UI Action would not work on any article created with a template. I looked in the UI Action and had to change the hard coded value of 'kb_knowledge' to the current table name. Once I did that it started working. I'm wondering if that UI Page (and widget in portal) is somehow referencing kb_knowledge instead of the template's table name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2018 07:50 PM
Same here...
I did find a fix to the KB Article Page widget (link below) which worked out, but still have the issue on the KB Category page...
https://hi.service-now.com/kb_view.do?sysparm_article=KB0692733