- 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-10-2023 06:56 AM
Hi @krishna kumar t ,
Create a module with the below condition.
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-10-2023 10:10 PM
Hii hemant
I have to show list of incident based on created by user group.
for Ex:
if A user is present in software group then when he logged IN he can able to see all incident created by the members present in the software group
if A user is present is more than one group he can able to see all the incident created by the all members in that group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 10:23 PM
Hii
i have used this script include
- 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.**