Show Incidents created by or assigned to particular group members.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 12:30 PM
Hi Team,
I have 3 groups
1. ServiceDesk
2. Hardware
3. Software
ServiceDesk group members can see their incidents and other 2 group incidents
Other 2 group members can only see their group incidents, but they should not see ServiceDesk groups or the other groups.
Help me on the same
Thanks
Anil!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 01:00 PM
Hi @AnilM99 ,
It is achievable only if Hardware and Software group members are not part of the Service Desk group. Please see the solution below:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 01:23 PM
Hi @AnilM99,
try below BR:
(function executeBeforeQuery(current, previous /*, displayValue, tableName*/) {
var userGroups = gs.getUser().getRoles(); // Get roles of the current user
if (userGroups.includes('ServiceDesk Group')) {
// Allow ServiceDesk Group to see all incidents
// No filtering needed
} else if (userGroups.includes('Hardware Group')) {
// Filter incidents to show only those of Hardware Group
current.addQuery('assignment_group', 'hardware_group_sys_id');
} else if (userGroups.includes('Software Group')) {
// Filter incidents to show only those of Software Group
current.addQuery('assignment_group', 'software_group_sys_id');
} else {
// Default behavior if no specific group condition is met
current.addQuery('sys_id', '!=', ''); // Some condition to always return an empty result
}
})(current, previous /*, displayValue, tableName*/);
and also check below link:
Thank you, please make helpful if you accept the solution.