How can i restrict the access of incidents specific assigned to group xyz only to it's group members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 12:57 AM
Hi,
I have requirement if incident assignment group is "XYZ" security checkbox is true. Then only part of the assignment group member incident ticket should visible. Other team should not have access to view these tickets.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 02:55 AM - edited 01-04-2024 02:57 AM
You can write below code:
(function executeRule(current, previous /*null when async*/) {
// Check if the user is a member of 'XYZ' assignment group
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', gs.getUserID());
gr.addQuery('group.name', 'XYZ'); // Preferable use group sys_id for query
gr.query();
// If the user is not a member of 'XYZ' assignment group, add a condition to the query
if (!gr.next()) {
current.addQuery('assignment_group', '!=', 'XYZ');
current.addQuery('security', '!=','true');
}
})(current, previous);
Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 03:08 AM
Hi @Sowmya20 ,
Please create a before query business rule as below:
In the advanced tab condition you should set
!gs.getUser().isMemberOf('XYZ');
In the script field set (replace the sysid with your assignment group (XYZ) sysID:
(function executeRule(current, previous /*null when async*/ ) {
var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','8a5055c9c61122780043563ef53438e3');
})(current, previous);
Above will only filter out the assignment group, so the code need to be altered a bit according to the checkbox.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 04:44 PM
hey i have tried this but does not work for some reason. it does hide the ticket for folks not in the group but when i belong to the group it shows all tickets. I want all groups to not be able to see the ticket and then i want the person that belongs to the group to only see there own groups tickets only.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 11:04 AM
This BR worked for me in trying to block other groups from seeing one groups incidents. Only issue now, how do I change the confirmation message on the service portal, that is generated when an INC is created to the group that does not want their incidents visible to others? Currently the message is "Sorry, either the data doesn't exist or you don't have access"...
How can change this ensure the user that their incident has been created to the group who's incidents are blocked from view?