Hide Icon Link in Portal

kkp
Kilo Contributor

Hi All,

I have created a Icon Link "Test List" in Service Portal home page.

Now i need to make it visible only for specific group(ex. Hardware). How can we do that.

Below is the sceen shot for your reference.

find_real_file.png

 

4 REPLIES 4

ErcelSotto
Giga Contributor

You can have something like this in your server script:

var currUser = gs.GetUser();
data.currUserRole = currUser.getRoles();

And in your client script, you can hide that card using angularjs:

HTML

<div ng-show="showCard">
  ...
  ...
</div>

client script:

if(data.currUserRole.indexOf("hardware") <= -1){
  $scope.showCard = true;
}

kkp
Kilo Contributor

Hi Ercel,

I do not find those fields in the form to write the scripts.

Can you please help me on where should i write the scripts.

 

Thanks,

Kiran

ErcelSotto
Giga Contributor

Try CTRL + right click anywhere near the your card then select Widget Editor.

Peter de Bock1
Mega Guru

Hi there,

 

We had the same question. There are since the last family release quite simple options to have Widgets visible for particular roles.You can clone for instance the "Icon link" widget and add a role to the cloned one to be used on your Portal. This is straight forward.

 

find_real_file.png

 

 

Another more advanced ability is to enable User Criteria for Service Portal (Widgets). For more check out:

https://docs.servicenow.com/bundle/paris-servicenow-platform/page/build/service-portal/task/activate-user-criteria.html

 

Please mark helpfull or answered if this helps you out 🙂

Regards, Peter