how to hide icon link in service portal based on the user roles

sobitha
Kilo Contributor

Can anyone help me to hide icon link in the service portal page based on the user roles

5 REPLIES 5

Gurpreet07
Mega Sage

Hi Sobitha,



You may need to clone existing widget to add a customized functionality.You need add widget option to get roles and then code accordingly in the widget. Please let me know if you further have doubts.


trishjohnson
Kilo Guru

We have a pretty unique use case in that our "catalog" is largely record producers, but here's what we are doing utilizing the "Available For" and "Not Available For" functionality.



Created validation variable rules that are then applied as AVAILABLE FOR or NOT AVAILABLE FOR.   Then based on those rules and the users applicability in them, they see the catalog cards only applicable to them when they're on our (please note CUSTOM) Service Portal.



This might be what you're asking, or might not.   But taking a shot it could help.




Below image and script is from the Rule that only displays "Greater Asia" related catalog items to a user with a country in greater Asia. But in this case Greater Asia is in the NOT available for category so does NOT see this item.



Basically....     you can get creative.



find_real_file.png



//Validation Variables


var servicedByAPSSC = false;



//User Variables


var currentUserID = gs.getUserID();


var userGR = new GlideRecord('sys_user');



//Validate user record


if(userGR.get(currentUserID)){



  // Check User is located in a Country Serviced by "APSSC"


  if(userGR.u_country.u_serviced_by == 'APSSC (Greater Asia)')


  servicedByAPSSC = true;



}



answer = servicedByAPSSC;


Trish -- this is similar to what we want to do.  Basically we have icon links pointing to Catalog Items.  What I want is if the user is not in the Available For related list on the item, then the icon link also disappears.  Now it still shows up and when the user clicks it, we get a blank page.  It just looks like the portal is broken.

So is there a way for a specific widget instance to get its "availability" from the item it is pointing to?

 

Thanks!

Shay Faingold
Mega Expert

Hi sobitha,

I found the field is just not visible on the form (roles).

In the 'Instance with Link' page, Right click on the header:

Configure > Form Design

Drag the Roles to any section.

Save

Simple as that 🙂

 

Thank you,

Shay