69 views

Description

Knowledge articles created using article templates are not displayed correctly in portal

Steps to Reproduce

  1. Login to a kingston instance and make sure that the plugin is com.snc.knowledge_advanced is installed .
    2. Go to Knowledge > article templates and make the template How to active (set the active field to true)
    3. restart the session : Logout/login again
    4. Go to Knowledge > Create new .
    5. You will be redirected to the article template selector , select the How to template .
    6. Fill in Knowledge Base , short description , introduction and instructions and submit and publish the article .
    7. Open the Knowledge article and click on try article to view it in the platform
       - The report is displayed correctly
    8. Get the sys if of the created article and view the record in portal :/sp?id=kb_article&sys_id=
    Expected : The article should be displayed correctly .
    Actual : The kb article content is not displayed : custom fields like introduction and instructions are not considered


Workaround

Service Portal's core offering does not support kb_template_* extension tables. This is a new functionality which is added to the Knowledge Management Service Portal plugin.

"Widgets and functionality in the "Knowledge Management Service Portal" plugin support the new fields introduced with the com.snc.knowledge_advanced plugin.After activating "Knowledge Management Service Portal", the /kb portal will have the new functionality." 

However there is a workaround which is working for the service portal without activating the advanced plugin.

1. Replace the below block in "KB artilce page widget" Server script :

if (articleGR.getValue('article_type') == 'wiki')
t.text = GlideWikiModel().render(articleGR.getValue('wiki'));
else
t.text = articleGR.getValue('text');


with some additional condition to consider articles created using templates:

if(articleGR.sys_class_name === 'kb_knowledge'){ // is not a template
if (articleGR.getValue('article_type') == 'wiki')
t.text = GlideWikiModel().render(articleGR.getValue('wiki'));
else
t.text = articleGR.getValue('text');
}
else { // is a template
var templateGR = new GlideRecord('kb_article_template');
templateGR.addQuery('child_table', articleGR.sys_class_name);
templateGR.query();
if(templateGR.next()){
var viewModelContext = {
isVersioningInstalled: function(){ return true; },
articleTemplateName: templateGR.getDisplayValue('article_template'),
knowledgeRecord: {
sys_id: articleGR.getDisplayValue('sys_id'),
sys_class_name: String(articleGR.sys_class_name)
}
}

var kbViewModel = new KBViewModel();
t.text = kbViewModel.getArticleTemplateContent.call(viewModelContext)
}
else {
t.text = '';
}

}

Related Problem: PRB1268347

Seen In

There is no data to report.

Intended Fix Version

Madrid

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-08-30 13:44:56
Published:2018-08-14