Override Reference Qualifier questions

Lee Kraus2
Tera Guru

A while back I created a Dictionary Override for our Assignment Group field that used a Script Include to hide 2 groups from most of the other groups in our org. Here is my current Override set up:

 

LeeKraus2_0-1666114302683.png

 

I would like to add another Script Include to the Reference Qualifier field, but every time I do, I get incorrect functionality, and break my currently working set up. It doesn't seem to let me create a second Incident table Dictionary Override for the Assignment Group field, and I get this error: "java.sql.BatchUpdateException: (conn=2456722) Duplicate entry 'incident-assignment_group' for key 'name' ", so I would like to know how I can either add my second Script Include I need for the field, or what I need to do to add it to my currently working script include to make it work.

 

Here is the scenario to assist in what I need.

 

In the current script include, I have if the logged in user isn't in a certain 3 groups, they can't see 2 specific groups:

 

LeeKraus2_1-1666114881766.png

 

One of those original 3 groups is my Service Desk Managers group. I created another group recently that I need hidden as an assignment group from all other groups except Service Desk Managers, so I created a Script Include that looks like this:

 

LeeKraus2_2-1666115125522.png

 

When trying to add the Script Include to the Reference Qualifier field in the Dictionary Override form, I copied the format I had used previously, like so:

 

LeeKraus2_3-1666115360987.png

 

and it breaks what I have already created and works. I tried having the field read "javascript: isGroupABC(); isGroupService_Desk_Managers();" but that didn't work either. [EDITED by ServiceNow to "fix" the invalid HTML inside the quotes]

 

I also edited my original Script include isGroupABC to this:

 

LeeKraus2_4-1666115600222.png

 

but this also seems to break what was already working. 

 

What am I supposed to be doing to make this work? I've at least added code to my original Script Include that makes it so nobody can see the new group unless you are in the 3 groups not excluded, but I want to exclude two of them from seeing this new group as well. 

 

Any help would be greatly appreciated, thank you!

2 REPLIES 2

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Just write one script include with the below format:-

 

if(user.memberof(servicedesk))
{
return default filter
}
else if(user.memberof(group2) || user.memberof(group3))
{
return sysid!-= write the one grp sysid which is only visible for servicedesk
}
else
{
retun sysid!= wirte all the four groups
}

 

Please mark my answer as correct based on Impact.

When I get a chance, I'll update my old script to this new one and see if it works. Then I'll let you know. 

 

Thank you for your reply!