User criteria "Any User"/"Any active user"

Alt30
Tera Contributor

Hello,

Could someone please clarify if it is necessary to set up a User Criteria "Any active user" with script answer = gs.getUser().isActive();

OR access to catalog items & Knowledge is set in ServiceNow for active users only anyway by default, unless another user criteria is applied?

So, say, if I want the catalog item to be visible to all active users of the platform, should I simply not add anything in Available for? OR I need to create specific User criteria that includes all active users?

Thanks in advance!

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Alt30,

 

As you've pointed out, inactive users cannot access the core platform, however, you can make catalog items and knowledge content available via portals which are public and do not necessarily require log in.

For this reason, use the following code within a User Criteria.

 

 

var grUser = new GlideRecord('sys_user');
grUser.get('sys_id',gs.getUserID());
if(grUser.active == true && grUser.locked_out == false){
	answer = true;
}else{
	answer = false;
}

 

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

View solution in original post

3 REPLIES 3

Weird
Mega Sage

It's a bit muddled, but by default the access should be there if there's no existing user criteria on a record.
On knowledge level I think there's a property that blocks access on articles with no user criteria, but I don't think there's one on catalog items.

Robbie
Kilo Patron
Kilo Patron

Hi @Alt30,

 

As you've pointed out, inactive users cannot access the core platform, however, you can make catalog items and knowledge content available via portals which are public and do not necessarily require log in.

For this reason, use the following code within a User Criteria.

 

 

var grUser = new GlideRecord('sys_user');
grUser.get('sys_id',gs.getUserID());
if(grUser.active == true && grUser.locked_out == false){
	answer = true;
}else{
	answer = false;
}

 

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Alt30
Tera Contributor

Thanks, Weird and Robbie. I used the code that Robbie shared to create "All active users" User criteria that I will be applying to knowledge articles and catalog items that do not have access restriction by a few other User Criteria I set up as per requirements.