Help with dictionary override reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 07:00 AM
Hello,
I need to create a dictionary override on the incident table with a reference qualifier that shows groups that are active and of a certain group type. I can do that by using type'<sysid>'^active=true
I also need one of the groups to only show up for users that have a certain role. How do i tie all of this together in one reference qualifier. I assume i will need a script include but need a little help.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 09:56 AM
its based on whether or a user has a certain role. If they have the role, the assignment group is available for selection.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2022 05:56 PM
cool. The script include below should get you close to what you want. If you run into any probs, let me know.
The other post putting all the code in the ref qualifier might work too so that might be worth checking out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 10:17 AM
Hello,
You do not have to write any script include you can achieve this completely in your reference qualifier.
Please use the below code. Just replace rolename, typereplacesysid and groupnamewhichdonotwantnotshow
javascript:if(gs.getUser().hasRole('rolename')) 'typeLIKEtypereplacesysid^active=true'; else'typeLIKEtypereplacesysid^active=true^name!=groupnamewhichdonotwantnotshow';
Please mark my answer as correct based on Impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 11:20 AM
Here's something I came up with. NOTE: have not tested.
here' is he script include:
Code:
var groups = [];
function getSpecialGroups(user) {
var check = checkUserRole(user);
check = check.toString(); //converting response to string just in case
var gr = new GlideRecord('sys_user_group');
gr.addEncodedQuery('type=1cb8ab9bff500200158bffffffffff62^active=true'); //here i picked the type 'itil' and active == true
gr.query();
while (gr.next()) {
groups.push(gr.sys_id.toString()); //push all the group sys_ids to the groups array. You always need to add toString when pushing to an array
}
if (check == 'true') { //if the use has the role, add this group sys_id
groups.push('287ee6fea9fe198100ada7950d0b1b73');
}
return groups; //send the list of group sys_ids back to the dictionary override
}
function checkUserRole(user) {
var checkRole = gs.hasRole('e098ecf6c0a80165002aaec84d906014'); //here i checked to see if the user has the role catalog
return checkRole; //this will return 'true' or 'false'
}
The script above needs the user passed from the dictionary override.
So in the dictionary override, you'd need something like:
javascript: new getSpecialGroups().getSpecialGroups(gs.getUserID())
Again, this is a rough cut but hopefully gets the wheels in motion. Let me know if you need some more help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 07:21 AM
How's the ref qualifier going?