Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

KBBlock - Global

The KBBlock API is included with knowledge blocks [com.snc.knowledge_blocks] as a script include. It provides methods to use with the knowledge blocks feature, such as integration with a custom knowledge article viewer.

Parent Topic:Integrating a custom search or knowledge article viewer with knowledge blocks

KBBlock - KBBlock()

Instantiates a KBBlock object in a global application.

NameTypeDescription
None  

KBBlock - getArticleContent(GlideRecord knowledgeRecord)

Gets knowledge articles with relevant knowledge block content that a user has access to read.

If you have activated the knowledge blocks feature and are using a custom knowledge article viewer with your application, your viewer may not display articles that expand the relevant block content. To expand block content that a user has access to read, you must call the getArticleContent() method inside your custom viewer.

NameTypeDescription
knowledgeRecordGlideRecordGlideRecord of the knowledge article to display.
TypeDescription
StringKnowledge article with relevant knowledge block content that a user has access to read.

Integrating a custom knowledge article viewer with knowledge blocks

// This function returns the article text with expanded block content.
function getArticleText(kbSysId) {
  var knowledgeRecord = new GlideRecord('kb_knowledge');
  var kbText='';
  if(knowledgeRecord.get(kbSysId)) {
    if(new GlidePluginManager().isActive('com.snc.knowledge_blocks')) {
      kbText = new KBBlock();
      kbText.getArticleContent(knowledgeRecord);
    }
    else
      kbText = knowledgeRecord.getValue('text');
    }
  return kbText;
}

// This is an example of how to call the function defined above.
var kbText = getArticleText('01a1ca5b6710130038876c3b5685efd3');