- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 07:27 AM - edited 12-15-2023 05:16 AM
Hi everyone,
I need help with a advanced reference qualifier.
If logged in user belong to a group which name start with "SN-CC" then he should see only his groups he belongs to + the one exception group with sys_id xyz.
All other logged in user which not belongs to a group which name start with "SN-CC" then he should see all assingment groups.
Thanks for help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 01:35 AM
Hello @JohnDF ,
Does this resolved your issue?? If yes, Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 06:54 AM - edited 12-15-2023 06:59 AM
Hello @JohnDF ,
I have tested below script please try and let me know.
var GroupFilter = Class.create();
GroupFilter.prototype = {
initialize: function() {
},
filterGroups: function() {
var user = gs.getUserID();
groupIds = [];
var groupFilter = '';
var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('user='+ user +'^group.nameSTARTSWITHSN-CC');
gr.query();
while(gr.next()){
groupIds.push(gr.group.sys_id);
}
if (groupIds.length > 0) {
groupFilter = 'sys_idIN' + groupIds.join(',') + ',c6c828c453751300ba3dddeeff7b1219'; // xyz is the sys_id of the exception group
return groupFilter;
}
},
type: 'GroupFilter'
};
To use this script include as a reference qualifier, you can use the following script:
new GroupFilter().filterGroups()
Kindly mark my answer as Correct and helpful based on the Impact.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 07:01 AM
Hello @JohnDF ,
Please see following link for callinf script include in reference qualifier.
https://www.servicenow.com/community/developer-forum/call-script-include-from-reference-qualifier/m-...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 06:44 AM
@Siddhesh Gawade hi thanks for reply,
here is my script include:
Here is my reference field on the case with the call.
the uer in the cc group can still see all groups when i search on case form in assingned group.
What could be the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 07:21 AM
Does it calling the script include? Have you checked using logging to confirm does the script include is being called.