Limit visibility of an assignment group in Incident form to only users with a specific role

bvarian
Mega Contributor

I've been asked by management to "hide" one of the Assignment Group choices for anyone except users with a specified role.  Basically, preventing incidents from being assigned to the highest escalation group prior to being vetted by others.

I took a look at ACLs and know I could use that to hide the entire field, but that's not what I'm wanting.

So I assume what I want is to do a Ref Qualifier and then point to a Script Includes script.

I created a Ref Qualifier:

find_real_file.png

I'm struggling however with the Script Includes, specifically the proper syntax. 

I have Assignment Groups A, B and C.  Roles E, F and G.  

I'd like Assignment Group A to be visible only to users with Role E.  Everyone else can see all other Assignment Groups except A.  

So based on my Reference Qualifier, I'd assume my Script Includes would start like this, but can anyone smarter than me please help me finish it?  I've been searching for examples to mimic and so far unsuccessful.    

function javascript:myGroupFilter() {

//Show All Assignment Groups for Role E
if (gr.userHasRole('Role E'))

return;

//Hide Assignment Group A for All other Roles

???????

 

 

 

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Bvarian,

 

Here you go.

function myGroupFilter() {

if (gs.hasRole('PASS ROLE NAME HERE'))
{ // Can see all records
return;
}

else
{
return 'name!=CAB Approval'; //Replace CAB Approval with the exact Assignment group name you would like to hide

}



}

 

Thanks,

Pradeep Sharma

View solution in original post

6 REPLIES 6

You are very welcome Bvarian. Thanks for participating in the community!

 

-Pradeep Sharma

Hi Pradeep,

For me this is not working please find my script include code below

var workgroupprivate = Class.create();
workgroupprivate.prototype = {
	initialize: function() {
		function myGroupFilter() {
			
			if (gs.getUser().hasRole('u_private_workgroup')) // users with this role can see all records
			{ 
				return;
			}
			else
			{
				return 'name!=Work Group: Unassigned Tickets'; // Pass the assignment group name that has to be hidden
			}
		}
	},
	type: 'workgroupprivate'
};

 

find_real_file.png