Reference qualifier on incident assignment group

soumya19
Tera Contributor

Hi,

 

I have a requirement to add reference qualifier on the incident assignment groups in with the below filters.

include Active = true

exclude type !=security groups

exclude the groups starting with "I-"

exclude the groups starting with "V-"

 

can anyone tell how to achieve this ?

1 ACCEPTED SOLUTION

jaheerhattiwale
Mega Sage
Mega Sage

@soumya19Tried and tested solution.

 

You need to add advanced reference qualifier as shown in image below

jaheerhattiwale_0-1671083199130.png

 

Script in the script include function:

getGroupQuery: function(){
var groupsNeedToBeExcluded = [];

var groupGr = new GlideRecord("sys_user_group");
groupGr.addQuery("nameSTARTSWITHI-^ORnameSTARTSWITHV-");
groupGr.query();

while(groupGr.next()){
groupsNeedToBeExcluded.push(groupGr.sys_id.toString());
}

return "typeNOT LIKEf196d9112f775110c4a0bed72799b608^ORtypeISEMPTY^sys_idNOT IN"+groupsNeedToBeExcluded.toString();
},

 

Note:

TestUtil() is script include, replace it with you script include.

Add getGroupQuery() function to your script inlcude

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

5 REPLIES 5

SuhasPSalunkhe
Kilo Guru

Do the following things - 

1. Create Script include OR take existing script include

2. Create function which return encodedquery/query which includes your all conditions.

3. Then it will work as you need. 

Mohit_Gupta
Tera Guru
Tera Guru

Hi @soumya19 ,

 

Can you please apply below filter in assignment group field dictionary :- 

Change the type value according to your requirement.

Mohit_Gupta_1-1671080897045.png

 

I hope this helps 

Please mark my answer correct if this helps you 

Thanks

Mohit

My requirement is to filter out the groups name starting with "I-" or "V-". The does not contain operator is filtering all the groups that have "I-" in name (middle of the name also).

 

Example: Does not contain will filter out all the below groups, but i need the group starting with "C-" (C-IFI-group).

I-my-group

V-my_group

C-IFI-group 

jaheerhattiwale
Mega Sage
Mega Sage

@soumya19Tried and tested solution.

 

You need to add advanced reference qualifier as shown in image below

jaheerhattiwale_0-1671083199130.png

 

Script in the script include function:

getGroupQuery: function(){
var groupsNeedToBeExcluded = [];

var groupGr = new GlideRecord("sys_user_group");
groupGr.addQuery("nameSTARTSWITHI-^ORnameSTARTSWITHV-");
groupGr.query();

while(groupGr.next()){
groupsNeedToBeExcluded.push(groupGr.sys_id.toString());
}

return "typeNOT LIKEf196d9112f775110c4a0bed72799b608^ORtypeISEMPTY^sys_idNOT IN"+groupsNeedToBeExcluded.toString();
},

 

Note:

TestUtil() is script include, replace it with you script include.

Add getGroupQuery() function to your script inlcude

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023