How to restrict group members not to see other category incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 11:28 PM
Hi,
Currently I have stucked in one point.
if the incident category is IT Infrastructure, then it should be visible to particular group (monitoring, delivery team) other categories should not be visible to these groups.
Regards,
Balateja.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 12:57 AM
Hi @Talari Balateja ,
Create a before query busisness rule:
(function executeRule(current, previous /*null when async*/) {
if (current.getTableName() === 'incident') {
var category = current.cat_item;
var allowedGroups = ['monitoring', 'delivery team'];
if (category === 'IT Infrastructure') {
current.addQuery('assignment_group', 'IN', allowedGroups);
} else {
current.addQuery('assignment_group', 'NOT IN', allowedGroups);
}
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 02:28 PM
I have tried but it's not hiding from other groups.
condition: gs.getUser().isMemberOf('Delivery Team') || gs.getUser().isMemberOf('Monitoring Team')
script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 09:25 PM
Hi @Talari Balateja
Go to System Security > Access Control (ACL).
2. Click “New” to create a new ACL.
3. Set “Type” to record.
4. Set “Operation” to read.
5. In “Name or Table”, select incident to apply this rule to the Incident table.
6. ACL Script :
(function executeRule(current, previous /null when async/) {
// Define the categories and groups
var allowedCategory = 'IT Infrastructure';
var allowedGroups = ['Monitoring', 'Delivery Team'];
// Check if the incident category matches the allowed category
if (current.category == allowedCategory) {
// Check if the current user is a member of the allowed groups
var userGroupGr = new GlideRecord('sys_user_grmember');
userGroupGr.addQuery('user', gs.getUserID());
userGroupGr.query();
while (userGroupGr.next()) {
var groupName = userGroupGr.group.getDisplayValue();
if (allowedGroups.indexOf(groupName) > -1) {
return true; // User is in an allowed group, grant access
}
}
return false; // User not in an allowed group, deny access
}
// For other categories, you might want to return true to not impact other access considerations
return true; // This line can be adjusted based on whether you wish to restrict or allow access to other categories for everyone or specific logic
})();
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning
Thanks & Regards
Deepak Sharma