<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How to make Knowledge Facet Field widget to display only a specific KB categories instead of displaying all KBs categories?  in ServiceNow AI Platform forum</title>
    <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184043#M140432</link>
    <description>&lt;P&gt;I have a requirement to display categories of a specific KB. When a user does a seach in the portal, the categories of the specific KB should be displayed after the search results are returned.&lt;BR /&gt;For this, I'm using a widget called Knowledge Field facet. The issue is it displays the categories from all the knowledge bases while I'm trying to show the category for the specific KB it's being used on. Here's the server script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function($sp) {&lt;/P&gt;
&lt;P&gt;if(!input){&lt;BR /&gt; //set instance sys_id to be used as unique id for collapse&lt;BR /&gt; options.table = "kb_knowledge";&lt;BR /&gt; data.instanceid = $sp.getDisplayValue('sys_id'); &lt;BR /&gt; options.min_result_count = options.min_result_count ? parseInt(options.min_result_count) : 10;&lt;BR /&gt; options.min_scroll_count = options.min_scroll_count ? parseInt(options.min_scroll_count) : 10;&lt;BR /&gt; options.max_string_length = options.max_string_length ? parseInt(options.max_string_length) : 80;&lt;BR /&gt; options.aggregate_query = options.aggregate_query ? options.aggregate_query == 'true' : false;&lt;BR /&gt; options.show_empty_value = options.show_empty_value ? options.show_empty_value == 'true' : false;&lt;BR /&gt; options.alt_url_params = options.alt_url_params || "";&lt;/P&gt;
&lt;P&gt;data.facet_depth = parseInt(gs.getProperty('glide.knowman.search.facet_depth') || 300);&lt;/P&gt;
&lt;P&gt;var facet_type = 'single_select';&lt;BR /&gt; if(options.custom_template){&lt;BR /&gt; var tempAry = options.custom_template.toString().split(",");&lt;BR /&gt; options.custom_template = tempAry[0];&lt;/P&gt;
&lt;P&gt;if(tempAry[1]){&lt;BR /&gt; facet_type = tempAry[1];&lt;BR /&gt; }&lt;BR /&gt; }else if(options.template){&lt;BR /&gt; if(options.template == 'kb_facet_multi_select'){&lt;BR /&gt; facet_type = 'multi_select';&lt;BR /&gt; }else if(options.template == 'kb_facet_dropdown_select'){&lt;BR /&gt; facet_type = 'dropdown_select';&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; options.facet_type = facet_type;&lt;BR /&gt; &lt;BR /&gt; //get html template from options&lt;BR /&gt; options.template = options.custom_template ? options.custom_template : (options.template ? options.template : "kb_facet_single_select");&lt;BR /&gt; //get the template URL/path&lt;BR /&gt; data.template = options.template;//$sp.translateTemplate(options.template);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; var kbService = new KBPortalService();&lt;BR /&gt; var valid_field = kbService.isValidFacetField(options.table,options.field_name,options.max_string_length);&lt;/P&gt;
&lt;P&gt;//Verification for Invalid Fields&lt;BR /&gt; data.valid_field = valid_field;&lt;BR /&gt; data.is_admin = gs.hasRole("admin");&lt;BR /&gt; }else{&lt;BR /&gt; if(input){&lt;BR /&gt; var result = {};&lt;BR /&gt; var facetService = new KBPortalService();&lt;BR /&gt; result = facetService.getFacetByName(&lt;BR /&gt; input.name,&lt;BR /&gt; input.value,&lt;BR /&gt; input.keyword,&lt;BR /&gt; input.language,&lt;BR /&gt; input.variables,&lt;BR /&gt; input.query,&lt;BR /&gt; input.order&lt;BR /&gt; );&lt;BR /&gt; data.result = new global.JSON().decode(result+"");&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;})($sp);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried KBv3 and made it to only show categories from a specific KB as required, but the team doesn't like the search result display of KBv3 because when you search, the categories are gone in the returned search result while the requirement is to keep the categories after the search result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 18:27:49 GMT</pubDate>
    <dc:creator>Alex223</dc:creator>
    <dc:date>2018-07-19T18:27:49Z</dc:date>
    <item>
      <title>How to make Knowledge Facet Field widget to display only a specific KB categories instead of displaying all KBs categories?</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184043#M140432</link>
      <description>&lt;P&gt;I have a requirement to display categories of a specific KB. When a user does a seach in the portal, the categories of the specific KB should be displayed after the search results are returned.&lt;BR /&gt;For this, I'm using a widget called Knowledge Field facet. The issue is it displays the categories from all the knowledge bases while I'm trying to show the category for the specific KB it's being used on. Here's the server script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function($sp) {&lt;/P&gt;
&lt;P&gt;if(!input){&lt;BR /&gt; //set instance sys_id to be used as unique id for collapse&lt;BR /&gt; options.table = "kb_knowledge";&lt;BR /&gt; data.instanceid = $sp.getDisplayValue('sys_id'); &lt;BR /&gt; options.min_result_count = options.min_result_count ? parseInt(options.min_result_count) : 10;&lt;BR /&gt; options.min_scroll_count = options.min_scroll_count ? parseInt(options.min_scroll_count) : 10;&lt;BR /&gt; options.max_string_length = options.max_string_length ? parseInt(options.max_string_length) : 80;&lt;BR /&gt; options.aggregate_query = options.aggregate_query ? options.aggregate_query == 'true' : false;&lt;BR /&gt; options.show_empty_value = options.show_empty_value ? options.show_empty_value == 'true' : false;&lt;BR /&gt; options.alt_url_params = options.alt_url_params || "";&lt;/P&gt;
&lt;P&gt;data.facet_depth = parseInt(gs.getProperty('glide.knowman.search.facet_depth') || 300);&lt;/P&gt;
&lt;P&gt;var facet_type = 'single_select';&lt;BR /&gt; if(options.custom_template){&lt;BR /&gt; var tempAry = options.custom_template.toString().split(",");&lt;BR /&gt; options.custom_template = tempAry[0];&lt;/P&gt;
&lt;P&gt;if(tempAry[1]){&lt;BR /&gt; facet_type = tempAry[1];&lt;BR /&gt; }&lt;BR /&gt; }else if(options.template){&lt;BR /&gt; if(options.template == 'kb_facet_multi_select'){&lt;BR /&gt; facet_type = 'multi_select';&lt;BR /&gt; }else if(options.template == 'kb_facet_dropdown_select'){&lt;BR /&gt; facet_type = 'dropdown_select';&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; options.facet_type = facet_type;&lt;BR /&gt; &lt;BR /&gt; //get html template from options&lt;BR /&gt; options.template = options.custom_template ? options.custom_template : (options.template ? options.template : "kb_facet_single_select");&lt;BR /&gt; //get the template URL/path&lt;BR /&gt; data.template = options.template;//$sp.translateTemplate(options.template);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; var kbService = new KBPortalService();&lt;BR /&gt; var valid_field = kbService.isValidFacetField(options.table,options.field_name,options.max_string_length);&lt;/P&gt;
&lt;P&gt;//Verification for Invalid Fields&lt;BR /&gt; data.valid_field = valid_field;&lt;BR /&gt; data.is_admin = gs.hasRole("admin");&lt;BR /&gt; }else{&lt;BR /&gt; if(input){&lt;BR /&gt; var result = {};&lt;BR /&gt; var facetService = new KBPortalService();&lt;BR /&gt; result = facetService.getFacetByName(&lt;BR /&gt; input.name,&lt;BR /&gt; input.value,&lt;BR /&gt; input.keyword,&lt;BR /&gt; input.language,&lt;BR /&gt; input.variables,&lt;BR /&gt; input.query,&lt;BR /&gt; input.order&lt;BR /&gt; );&lt;BR /&gt; data.result = new global.JSON().decode(result+"");&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;})($sp);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried KBv3 and made it to only show categories from a specific KB as required, but the team doesn't like the search result display of KBv3 because when you search, the categories are gone in the returned search result while the requirement is to keep the categories after the search result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 18:27:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184043#M140432</guid>
      <dc:creator>Alex223</dc:creator>
      <dc:date>2018-07-19T18:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Knowledge Facet Field widget to display only a specific KB categories instead of displaying all KBs categories?</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184044#M140433</link>
      <description>&lt;P&gt;Hey Alex, were you able to implement this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 11:27:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184044#M140433</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2019-04-15T11:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Knowledge Facet Field widget to display only a specific KB categories instead of displaying all KBs categories?</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184045#M140434</link>
      <description>&lt;P&gt;This functionality is now available with New York. Use the 'Knowledge Bases" related tab.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 04:43:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/how-to-make-knowledge-facet-field-widget-to-display-only-a/m-p/1184045#M140434</guid>
      <dc:creator>natty29</dc:creator>
      <dc:date>2019-09-02T04:43:52Z</dc:date>
    </item>
  </channel>
</rss>

