User Criteria for group managers

Brad Campbell
Tera Contributor

Hi All

 

Looking to create a new user criteria so I can restrict visibility of a catalogue item I am building to just group managers.

 

Any guidance appreciated as ever.

 

Brad

 

 

1 ACCEPTED SOLUTION

Chandler Paulse
Tera Expert

You could try something like this: 

answer = checkCondition();
function checkCondition(){
	var gr = new GlideRecord("sys_user_group");
	gr.addQuery("manager", user_id); //Looks to see if this user is listed as a manager on any user record
	gr.setLimit(1);
	gr.query();

	if(gr.hasNext()) //If the user is listed as a manager in a group
		return true;
	else
		return false;
}

 

View solution in original post

5 REPLIES 5

Chandler Paulse
Tera Expert

You could try something like this: 

answer = checkCondition();
function checkCondition(){
	var gr = new GlideRecord("sys_user_group");
	gr.addQuery("manager", user_id); //Looks to see if this user is listed as a manager on any user record
	gr.setLimit(1);
	gr.query();

	if(gr.hasNext()) //If the user is listed as a manager in a group
		return true;
	else
		return false;
}

 

Thanks for your help, tested and working.

SingL
Tera Contributor

Hi what will be the best practice to make a catalog item visible for 200 user with no common attributes apart from snc_internal role?

Create a custom role and give that role to the users that should see the catalog item. Also could create a group with those users and base the user criteria on that.