- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 06:30 AM
Hii Guys,
My requirement is i have created one module under incident ,in that module i have to display incident created by my group members.
For Ex: if logged in user is member of X group.he can able to see the all incident created by the group members in the module created under incident.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 11:49 PM
Hi @krishna kumar t,
Please find the below script which can fetch if the user is present in more than one group.
var currentUser = gs.getUser();
var groups = currentUser.getMyGroups();
var processedUsers = {};
for (var i = 0; i < groups.size(); i++) {
var group = groups.get(i);
var users = new GlideRecord('sys_user_grmember');
users.addQuery('group', group);
users.query();
while (users.next()) {
var user = new GlideRecord('sys_user');
if (user.get(users.getValue('user'))) {
if (!processedUsers[user.getUniqueValue()]) {
processedUsers[user.getUniqueValue()] = true;
gs.print(user.getValue('name'));
}
}
}
}
I hope this helps!
Regards,
Hemant
**Please mark the appropriate response as the correct answer and helpful, This may help other community users to follow the correct solution.**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 09:54 PM
Thanks you so much hemant for your help and time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 07:09 AM