<?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 control Popular Items content in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862289#M519215</link>
    <description>&lt;P&gt;I’m seeing in other Community postings that you can control what shows up in the Service Portal "Popular Items" by cloning the SC Popular Items widget and adding script like I’ve done in the below screenshot.&amp;nbsp; This is not getting me the desired results and does appear to be removing any of the catalog items I need removed from Popular Items.&amp;nbsp; &amp;nbsp;If I right-click/Ctrl on Popular Items in the Service Portal and select Instance in Page Editor, the widget it is using is SC Category Page.&amp;nbsp; So, should I actually be cloning the SC Category Page widget and adding my script to that?&amp;nbsp; &amp;nbsp;If so, where?&amp;nbsp; I don’t see anywhere its Server Script that it is doing any count.AddQuery.&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46366iB7B3E9A0B57282D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2022 13:27:45 GMT</pubDate>
    <dc:creator>chrish5</dc:creator>
    <dc:date>2022-05-26T13:27:45Z</dc:date>
    <item>
      <title>How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862289#M519215</link>
      <description>&lt;P&gt;I’m seeing in other Community postings that you can control what shows up in the Service Portal "Popular Items" by cloning the SC Popular Items widget and adding script like I’ve done in the below screenshot.&amp;nbsp; This is not getting me the desired results and does appear to be removing any of the catalog items I need removed from Popular Items.&amp;nbsp; &amp;nbsp;If I right-click/Ctrl on Popular Items in the Service Portal and select Instance in Page Editor, the widget it is using is SC Category Page.&amp;nbsp; So, should I actually be cloning the SC Category Page widget and adding my script to that?&amp;nbsp; &amp;nbsp;If so, where?&amp;nbsp; I don’t see anywhere its Server Script that it is doing any count.AddQuery.&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46366iB7B3E9A0B57282D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 13:27:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862289#M519215</guid>
      <dc:creator>chrish5</dc:creator>
      <dc:date>2022-05-26T13:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862290#M519216</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your query should be&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;count.addQuery('cat_item.category!=sys_id_of_category');&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;count.addEncoddedQuery('cat_item.categoryNOT LIKEIT ONLY');&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Sagar Pagar&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 13:36:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862290#M519216</guid>
      <dc:creator>Sagar Pagar</dc:creator>
      <dc:date>2022-05-26T13:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862291#M519217</link>
      <description>&lt;P&gt;Hello Chrish,&lt;/P&gt;
&lt;P&gt;Yes you need to clone the widget "SC category page". Below are the steps&lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46363i1B74D9756EA8B482/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) On widget, you have to go to the&amp;nbsp;function getPopularItems () on 156 line of the server code to change the query conditions. Please see below screenshots&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46364i86A9D73667F73878/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope it helps!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please Mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct/helpful, if applicable, Thanks!!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Sulabh Garg&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 13:42:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862291#M519217</guid>
      <dc:creator>Sulabh Garg</dc:creator>
      <dc:date>2022-05-26T13:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862292#M519218</link>
      <description>&lt;P&gt;Hi Sulabh,&lt;/P&gt;
&lt;P&gt;Thank your for you reply.&amp;nbsp; My SC Category Page server script&amp;nbsp;is not the same.&amp;nbsp; (full version attached)&amp;nbsp; These count.addQuery lines are what I saw and edited on the SC Popular Items widget server script.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46360i1954808BABFA5AE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:59:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862292#M519218</guid>
      <dc:creator>chrish5</dc:creator>
      <dc:date>2022-05-26T14:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862293#M519219</link>
      <description>&lt;P&gt;Hi Chrish,&lt;/P&gt;
&lt;P&gt;Can you please check if your widget is customized by someone? Or It may be you are on san diego version and the code which I put in my screenshot above was from my PDI (Rome).&lt;/P&gt;
&lt;P&gt;Hope it helps!!&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 13:11:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862293#M519219</guid>
      <dc:creator>Sulabh Garg</dc:creator>
      <dc:date>2022-05-27T13:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862294#M519220</link>
      <description>&lt;P&gt;Hi Sulabh,&lt;/P&gt;
&lt;P&gt;The script I provided is from the OOB&amp;nbsp;SC Category Page widget on NOT my cloned version I've been playing around with, so it has not been edited. Yes, it may be the difference between Rome and San Diego.&amp;nbsp; Any suggestions on updating our San Diego version to add a count.addQuery lines to control Popular Items content would be helpful.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the meantime, I have changed the below section of script in the SC Category Page server script from this.......&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;data.show_more = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; if (GlideStringUtil.nil(data.category_id)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; data.items = getPopularItems();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; data.show_popular_item = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; data.all_catalog_msg = (($sp.getCatalogs().value + "").split(",")).length &amp;gt; 1 ? gs.getMessage("All Catalogs") : "";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; data.all_cat_msg = gs.getMessage("All Categories");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; data.category = {title: gs.getMessage("Popular Items"),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; description: ''};&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;to this, to hide the Popular Items.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt; data.show_more = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;if (GlideStringUtil.nil(data.category_id)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="color: #000000;"&gt;So now it defaults to this when no category is selected.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/46365i9A7AE38FB4A34EC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="color: #000000;"&gt;Ultimately, I would like to put Popular Items back, but NOT have it showing any catalog items that are under the "IT ONLY" category.&amp;nbsp; &amp;nbsp;Any suggestions on how to accomplish this would be appreciated.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="color: #000000;"&gt;Thanks,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="color: #000000;"&gt;Chris&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 13:35:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862294#M519220</guid>
      <dc:creator>chrish5</dc:creator>
      <dc:date>2022-05-27T13:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862295#M519221</link>
      <description>&lt;P&gt;You can try this function inside server script, Here you can mention your conditions to restrict the popular items.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;function queryItems&lt;/STRONG&gt;(catalog, categoryId, startWindow, endWindow) {&lt;BR /&gt; var scRecord = new sn_sc.CatalogSearch().search(catalog, categoryId, '', false, options.show_items_from_child != 'true');&lt;BR /&gt; scRecord.addQuery('sys_class_name', 'NOT IN', 'sc_cat_item_wizard');&lt;BR /&gt; scRecord.addEncodedQuery('hide_sp=false^ORhide_spISEMPTY^visible_standalone=true');&lt;BR /&gt; scRecord.chooseWindow(startWindow, endWindow);&lt;BR /&gt; scRecord.orderBy('order');&lt;BR /&gt; scRecord.orderBy('name');&lt;BR /&gt; scRecord.query();&lt;BR /&gt; return scRecord;&lt;BR /&gt; }&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 14:26:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862295#M519221</guid>
      <dc:creator>Sulabh Garg</dc:creator>
      <dc:date>2022-05-30T14:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862296#M519222</link>
      <description>&lt;P&gt;Hi Sulabh,&lt;/P&gt;
&lt;P&gt;I've tried coding this several different ways.&amp;nbsp; See the three // lines below for what I've tried.&amp;nbsp; None of these worked by filtering out catalog items where the category was IT Only.&amp;nbsp; Open to suggestions.&amp;nbsp; Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function queryItems(catalog, categoryId, startWindow, endWindow) {&lt;BR /&gt; var scRecord = new sn_sc.CatalogSearch().search(catalog, categoryId, '', false, options.show_items_from_child != 'true');&lt;BR /&gt; scRecord.addQuery('sys_class_name', 'NOT IN', 'sc_cat_item_wizard');&lt;BR /&gt; scRecord.addEncodedQuery('hide_sp=false^ORhide_spISEMPTY^visible_standalone=true');&lt;BR /&gt; &lt;SPAN style="color: #ff0000;"&gt;//scRecord.addEncodedQuery('category!=fd4980572bc78d002f5e8740f8da1502');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; //scRecord.addEncodedQuery('cat_item.category!=fd4980572bc78d002f5e8740f8da1502');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;//scRecord.addEncodedQuery('cat_item.categoryNOT LIKEIT ONLY');&lt;/SPAN&gt;&lt;BR /&gt; scRecord.chooseWindow(startWindow, endWindow);&lt;BR /&gt; scRecord.orderBy('order');&lt;BR /&gt; scRecord.orderBy('name');&lt;BR /&gt; scRecord.query();&lt;BR /&gt; return scRecord;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 12:50:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862296#M519222</guid>
      <dc:creator>chrish5</dc:creator>
      <dc:date>2022-06-03T12:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to control Popular Items content</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862297#M519223</link>
      <description>&lt;P&gt;I had a similar issue in the San Diego version. I have replaced &lt;CODE&gt;getPopularItems()&lt;/CODE&gt; function with the old Rome version. Doing this my issue was resolved.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 05:19:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-control-popular-items-content/m-p/1862297#M519223</guid>
      <dc:creator>vishal86</dc:creator>
      <dc:date>2022-09-19T05:19:42Z</dc:date>
    </item>
  </channel>
</rss>

