Question

How to hide an entire section on support portal depending on requester group

  • 10 November 2023
  • 2 replies
  • 150 views

I'm looking to create a dedicated section on my support portal featuring onboarding and offboarding cards exclusively accessible to HR department users.

Currently, utilizing the Service Management - Employee Onboarding configuration allows me to conceal the onboarding/offboarding cards for individuals outside the designated contact group. However, I want to extend this capability to hide the entire section.

The reason I want to hide an entire section is because I intend to customize the cards by incorporating a heading, buttons, around it, thus card concealment is insufficient; I require the ability to hide the entire div.

If anyone is familiar with the JavaScript logic responsible for hiding cards based on contact groups, I would greatly appreciate guidance in replicating it.

Thank you!


2 replies

Userlevel 5
Badge +5

Hello @corndoggy 

Hope you are well, really apologize for the delay in response.

I am not really well-versed with Java-script but I can point you towards the right-direction, you can use the following attributes in the Portal customization to make the Cards or fields visible/invisible:

This is a sample code of Hiding cards on basis of Departments:

<script>  var UserIsMember = JSON.stringify(USER_INFO.departments).includes('G2G/EB');      console.log('is member: ' + UserIsMember);  if(UserIsMember === true) {  //     $('body').attr('user','Onboarding');  var removeCardsUrl = ['/support/approvals/pending','/support/catalog/items','/support/employee_onboarding/new','/support/solutions','/support/approvals'];  CARDS = CARDS.filter(function(card) {   return removeCardsUrl.indexOf(card.url) < 0;  });      }</script>

You can paste this in the Page Layout section. 

Hope this helps! Let me know your thoughts!

Happy Holidays!😊

 

-

Reply