logo

NJP

Content Block with a Knowledge Article

Import · Nov 09, 2017 · article

I often include KB articles in Dashboards via a Content Block to bring in additional explanation into the analytics that the Dashboard displays. I recently ran into an instance that had the Knowledge Management Advanced plugin enabled which adds versioning to KB articles. This is great functionality, but it caused an issue with you include a specific KB article into a content block. With versioning, each version gets its own sys_id so if you use the standard "Show a specific document" type that links to a KB article, you get the version you select but not new versions.

To handle this in your content block, change the type to "Use Script to find a document" and set the script value to this (remember to change the KB article number on line 11):

var latestVersion = function (number)
{
    var gr = new GlideRecord('kb_knowledge');
    gr.addQuery('number','=', number);
    gr.orderByDesc('version.modified_on');
    gr.setLimit(1);
    gr.query();

    gr.next();

    return gr;
};
latestVersion('KB0017035');
View original source

https://www.servicenow.com/community/now-platform-articles/content-block-with-a-knowledge-article/ta-p/2304711