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

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

There is something similar already on community that you may find helpful.

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Yes, that's the exact community link I was using to determine that the best approach was the RefQual and Script Includes.  I also referenced this Community article.  I'm not trying to be helpless; I'm just not nailing the syntax and was hoping to get some assistance from someone more knowledgeable about Java code than me.

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

Pradeep....that worked like a charm.  Thank you so much for the assistance!