SC Categories widget - Hiding a Category
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:41 PM
Hi Team,
We are on Istanbul and I want to hide a specific category on a cloned SC Categories Widget. While the Widget works as designed I do not want to show "Report an Incident"
I have made "Infrastructure" category only available to ITL users. However, the "Report an Incident" still needs to be available to all users, just not visible on my cloned widget.
I suspect it will be a line of code along the lines of "If category = "Report an Incident" then hide"
However I am not a coder by occupation and would like some assistance if soemone can help.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:46 PM
Hi Andrew
If you create a checkbox on sc_category table named something like "hide on SP" and the edit the query in the server script from:
Line 18 and forward
var sc = new GlideRecord('sc_category');
sc.addQuery('sys_class_name', 'sc_category');
sc.addQuery('u_hide_on_sp', true);
sc.addActiveQuery();
sc.orderBy('title');
data.sc_catalog = $sp.getValue('sc_catalog');
if (data.sc_catalog)
sc.addQuery('sc_catalog', data.sc_catalog);
if (options.category_layout === "Nested")
sc.addQuery('parent', '');
sc.query();
data.categories = retrieveCategoriesFromGR(sc);
I whould give that a try - though i havent tested this
Regard
Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2019 07:24 AM
Hi Andrew,
How did you solve this? Please share
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2020 03:43 PM
In my New York version personal instance, in the server script for the widget
The fetchCategories function
starting at line 109, I inserted the if statement below using the sys id of the category to hide:
var categoryDetails = getCategoryDetails(categoryJS, 0);
categoryDetails.sys_id = categoriesGr.getUniqueValue();
//Do not show Can We Help
if (categoryDetails.sys_id == 'e15706fc0a0a0aa7007fc21e1ab70c2f')
continue;
categories.push(categoryDetails);