- 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-05-2024 06:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 09:46 AM
I have created a report on 'sys_user' table and called a script from script include class name and function name please find attached screen shot for your reference, while running that script in backgrounds its working and getting the expected results which is which user not a part of any group and those have abcd role, Thank you!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 10:23 AM
Thank you! Sounds like your script include is not client callable. In order for it to work in filter conditions, you need to make it client callable.
Best regards,
Rene
Please mark as correct/helpful if my answer helped you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 11:12 AM
@Rene El Hamzh even I have checked that client callable as well is not working, is there any other suggestions please