Restrict visibilty of tickets based on Assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 12:09 AM
Hi Team,
We have 5 towers such as A,B,C,D and E and each tower has different assginment group,and we can differiantate the assignment group on the basis of Type field in Groups table, So we want members who belongs to any one of the towers and its respective assigmnet group,should not be visible to see tickets of other towers or should not be able to redirect tickets to them.
How we can achieve this.
Regards,
Karan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 12:14 AM
You can follow below link to achieve the same.
You are looking for Before Query BR
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 12:17 AM
Hi Karan,
It can be done by two approaches, 1. Using BR and 2. using ACL.
But I suspect that a 'BR query' would hide the record and ACL would be the most suitable approach for making it read only.
OOB the platform has a number of ACL's that check if the user is a member of the current.assignment_group and you should be able to use these as a reference.
/sys_security_acl_list.do?sysparm_query=scriptLIKEgs.getUser().isMemberOf&sysparm_view=
OR, if you want to go with BR, then try something like this :
var u = gs.getUserID();
if((!u.isMemberOf(current.assignment_group) && current.caller_id != u && current.opened_by != u) && gs.getSession().isInteractive()){
var q = current.addQuery('assignment_group', getMyGroups()).addOrCondition('caller_id', u).addOrCondition('opened_by', u).addOrCondition("watch_list", "CONTAINS", u);
}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 05:15 AM
Hi Sandeep,
I tried the below code:
var u = gs.getUserID();
if((!u.isMemberOf(current.assignment_group) && current.caller_id != u && current.opened_by != u) && gs.getSession().isInteractive()){
var q = current.addQuery('assignment_group', getMyGroups()).addOrCondition('caller_id', u).addOrCondition('opened_by', u).addOrCondition("watch_list", "CONTAINS", u);
}
but its not working,I am doing it for Cases in CSM.
Thanks,
Karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 12:32 AM
Hi,
Is the ticket table being referred here is incident table?
If yes then you can update the OOB query BR on that incident table and restrict it
Sample Script would look like this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
current.addQuery('assignment_group', "IN", groups.toString());
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader