- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 02:05 AM
which users are not in any one group and have a 'abcd' role, I have to create a report on those users so for this I have written script in script include and called in reports but Iam not getting proper result but through background scripts I got expected results.
which I written the script is:
function testmon(){
var grMember = new GlideRecord('sys_user_grmember');
grMember.query();
var groupMembers = [];
while (grMember.next()) {
groupMembers.push(grMember.user.toString());
}
var user = new GlideRecord('sys_user');
user.addQuery('sys_id', 'NOT IN', groupMembers);
user.addQuery('roles', 'abcd'); // Add condition to check if user has 'resource' role
user.query();
var nonGroupMembers = [];
while(user.next()) {
nonGroupMembers.push(user.name.toString());
}
return nonGroupMembers;
}
Please can any one help me on this query.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 08:54 AM
The script include looks good to me! However, I see you now have a typo in the method name when calling it in the filter condition and also the javascript needs to be lowercase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 03:39 AM
Could you also please attach a screenshot of your script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 05:32 AM
@Rene El Hamzh Yes I have attached script include and report screen shot, Please find below
the script include script is :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 08:54 AM
The script include looks good to me! However, I see you now have a typo in the method name when calling it in the filter condition and also the javascript needs to be lowercase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 12:21 PM
@Rene El Hamzh Thanks for your help it's working as expected.