- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 01:20 AM
I want to restrict the groups displayed in the assignment_group field on the incident form using a reference qualifier. However, I am unable to find the dictionary entry for assignment_group in the incident table. I discovered that the reference table is task, which itself references another table. I believe the base table might be sys_user_group, but I am not certain. Can someone provide guidance on this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2024 02:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 08:11 AM
Sorry Gangadhar, is it possible to call a script include in a reference qualifier?, I have tried but its not working, Any tips or ideas will help me, Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 09:45 AM - edited ‎05-20-2024 09:45 AM
Try viewing existing dictionary records where 'Reference qual starts with javascript, Reference qual contains new to see examples.
https://<instance_name>.service-now.com/sys_dictionary_list.do?sysparm_query=reference_qualSTARTSWITHjavascript%5Ereference_qualLIKEnew&sysparm_view=advanced
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 08:32 AM
Hi @JJose ,
Follow the below steps:
Do dictionary override on incident table & Add the below code in reference qualifier field:
javascript:'sys_idIN'+new TT().groups(); (Replace TT with your script include name & groups with your function Name)
You can write the logic in your script include so that it will return comma separated sys id's of the groups.
Ex:
groups: function() {
var gr = new GlideRecord('sys_user_group');
gr.addQuery('active', true);
gr.query();
var groups = [];
while (gr.next()) {
groups.push(gr.sys_id.toString());
}
return groups.join(',');
},
This worked for me.
I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 11:39 AM
I am trying to use the script below to remove 2 groups from the assignment_group on the PDI instance, but it is not working. Can you check what's wrong?
Reference Qualifier --> javascript:'sys_idIN'+new TT().groups();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2024 07:13 PM
Hi @JJose ,
The function declaration is the issue i guess.
Add the below code in your script include.
groups: function() {
var gr = new GlideRecord('sys_user_group');
// Add a query to filter only active groups
gr.addQuery('active', true);
gr.addQuery('name', '!=', 'Database'); // Exclude the group with name 'test1'
gr.addQuery('name', '!=', 'Hardware'); // Exclude the group with name 'test2'
// Execute the query
gr.query();
// Initialize an empty array to hold the sys_id values
var groups = [];
// Iterate over the results
while (gr.next()) {
// Add the sys_id of each group to the array
groups.push(gr.sys_id.toString());
}
// Return the sys_ids as a comma-separated string
return groups.join(',');
},
In the dictionary override reference qualifier make sure you replace TT with your script include name.
I tested the code & works for me. Please check & If my answer helped you in any way, please mark it as helpful or correct.