Reference qualifier in not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 03:26 AM
Hello Folks,
I've a requirement to not show the groups with no users in the assignment group field. For this I've written script script and used that in the task table's assignment group field advanced ref qualifier. But I'm trying this I'm getting the groups with users and the script include may be not calling. I'm giving the script and ref qualifier. Please help to correct this 🙂
Thanks,
Avee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 04:27 AM
Hi @Avee90 ,
Please try like javascript: new groupwithUser().getGroups()
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 06:40 AM
Hi @Avee90 ,
I think the script include is not returning correct value could you please try below code ?
var getGroupWnoMem = Class.create();
getGroupWnoMem.prototype = {
initialize: function() {},
getGroup: function() {
var gr = new GlideRecord('sys_user_group');
gr.addActiveQuery();
gr.query();
var arr = [];
while (gr.next()) {
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', gr.getValue('sys_id'));
grMember.query();
var count = grMember.getRowCount();
// gs.info('RowCount' + count);
if (count <= 0) {
arr.push(gr.getValue('sys_id'));
}
}
// gs.info('array' + arr);
return 'sys_idIN' + arr;
},
type: 'getGroupWnoMem'
};
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 07:07 AM
@Avee90 In your script include on Line number 14 you are incrementing a count variable which you have not defined previously. Due to this the script is crashing at liner number 14. Either define the count variable as var count = 0; before the loop or comment the line number 14 altogether.
Hope this helps.