KBBlock - Global

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:2分
  • 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.

    KBBlock - KBBlock()

    Instantiates a KBBlock object in a global application.

    表 : 1. Parameters
    Name Type Description
    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.

    表 : 2. Parameters
    Name Type Description
    knowledgeRecord GlideRecord GlideRecord of the knowledge article to display.
    表 : 3. Returns
    Type Description
    String Knowledge 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');