The CreatorCon Call for Content is officially open! Get started here.

Restrict part of a portal widget with user criteria

Leri Andrews
Tera Guru

Hoping a portal development specialist can help.

I have a 'Contact Us' page that displays contact details for the three functions HR, Finance and IT.  Users click on an icon representing each area and, based on their location, there appears below all the details they need.  I also have an established user criteria that defines a particular employee population who are transitioning into the support of these functions.

The requirement is for this particular group of employees to only be able to see the IT button at the moment (as the other business desks do not support them yet.)

The problem is that I have been told that user criteria can only be applied to the widget and not the html inside the widget.

Can anyone think of a way that user criteria can be used in this scenario?

 

2 REPLIES 2

Harish KM
Kilo Patron
Kilo Patron

Hi you need to glide in server script check whether the logged in user is a part of group if yes and place this as anwer = true

and in HTML widget you need to place using ng-if to check and inside that you can place the IT button

Example

<li ng-if = "data.answer1 == true">//satisfy condition
 <a href="/link">IT</a>
 </li>
 
 //IT  should be hidden

var currentUserID = gs.getUserID(); 
var userGR1 = new GlideRecord('sys_user');
if(userGR1.get(currentUserID)){
if(condition)
{
data.answer1 = true;
}

else
{
data.answer1 = false;
}

Regards
Harish

Mohith Devatte
Tera Sage
Tera Sage

Hello @Leri Andrews can you please share the screenshots again ?they are broken