Question

Support Portal > Service Catalog customization help

  • 14 December 2022
  • 4 replies
  • 212 views

Badge

Greetings. I would like to hide some service categories from view when users browse the service catalog. I was able to accomplish this by adding the following code, which I was able to put together using various posts here, to Helpdesk Rebranding > Customize portal > Page layout. 

<script type = "text/javascript">
var cur_loc = window.location.pathname,
req_loc = "/support/catalog/items";

if (cur_loc == req_loc) {
jQuery(document).ready(function() {
jQuery("[data-id='"+21000249967+"']").hide();
jQuery("[data-id='all']").hide();
jQuery("#catalog-list-items").hide();
jQuery("<h3>Please select from one of the categories on the left.</h3>").insertAfter("#catalog-list-items");
jQuery("#categories-list").click(function () {
jQuery("#catalog-list-items").show();
jQuery('h3:contains(Please select from one of the categories on the left.)').hide();
});
}); }
</script>

However, I have run into an issue where the changes only appear when the user refreshes the page. If the user navigates to the service catalog via the corresponding card or nav menu link, the script does not appear to run since no changes are rendered.

In this image you can see how the page looks when loaded from either the card or menu link.

 

This is the view the user gets if the page is refreshed.

 

How can I make it so that the changes are always visible without the user needing to refresh the page?

 


4 replies

Badge

Hello,

Out of curiosity, why are you not using the setting (at the service item level) to restrict who can view the item in the catalog?
 

However, if you’d like to hide the “All Service Items” category, I don’t know how to proceed except by using customization like the one you did set up.

Best,
Matthieu

Badge

@matthieu.cote I wish it was that easy. The items I am trying to hide from view are specifically for use in the onboarding module. As I’m sure you are probably aware, if I restrict the visibility of the item in the Service Catalog for requesters, then it will also be restricted in the Onboarding module as well. If there is a different solution for this that I am unaware of, please let me know.

It is not a requirement to hide “All Service Items” categories, if I could hide specific items from that view individually.

 

Userlevel 5
Badge +8

@matthieu.cote I wish it was that easy. The items I am trying to hide from view are specifically for use in the onboarding module. As I’m sure you are probably aware, if I restrict the visibility of the item in the Service Catalog for requesters, then it will also be restricted in the Onboarding module as well. If there is a different solution for this that I am unaware of, please let me know.

It is not a requirement to hide “All Service Items” categories, if I could hide specific items from that view individually.

 

Hi mwagnon. is it possible to create separate catalog for onboarding? so that you can set access per group.

Userlevel 7
Badge +16

Hello @mwagnon so the code is a little different in regards to the New Generation Support Portal. The code you are using was for the original support portal when we wrote it.

Try this and see if it works for you.

<!-- Hide All service items, to just show the white screen with the text -->
<script>
jQuery(document).on('PageUpdate', function() {
setTimeout(function() {
if (window.location.href.endsWith("support/catalog/items")) {
jQuery("#catalog-list-items").hide();
jQuery("<h3 style='padding: 20px'>Please select from one of the categories on the left.</h3>").insertAfter("#catalog-list-items");
jQuery("#categories-list").click(function () {
jQuery("#catalog-list-items").show();
jQuery('h3:contains(Please select from one of the categories on the left.)').hide();
});
}
});
});
</script>

Hope this helps :)

Reply