- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:51 PM
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 ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:48 PM
@soumya19Tried and tested solution.
You need to add advanced reference qualifier as shown in image below
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.
ServiceNow Community Rising Star, Class of 2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:56 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:08 PM
Hi @soumya19 ,
Can you please apply below filter in assignment group field dictionary :-
Change the type value according to your requirement.
I hope this helps
Please mark my answer correct if this helps you
Thanks
Mohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:20 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:48 PM
@soumya19Tried and tested solution.
You need to add advanced reference qualifier as shown in image below
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.
ServiceNow Community Rising Star, Class of 2023