- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:07 PM - edited 04-19-2023 07:29 PM
Hi,
I have a business rule I implemented as we have a group of users outside of out Core IT area that we want to be able to assign certain incident, requests etc to work on. We didn't want them to have full access to all other items though as no need for them to see it. I made the below rule that works fine from that point of view however it stops them from seeing any tickets that are in their name or watchlist as those tickets are not part of the correct assignment group to meet my rule. So I need to modify it so if assigned to one of their groups or they are the caller, requester or watch list they can see the tickets. I could maybe do with ACL but I'm trying to keep it simple and not have to change a heap of ACL's to get this to work in both cases.
(function executeRule(current, previous /*null when async*/) {
if (gs.hasRole('itil') && !gs.hasRole('admin') && gs.getUser().isMemberOf('LMS Support')) {
current.addEncodedQuery("assignment_group=javascript:gs.getUser().getMyGroups()");
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 08:42 PM
Hi @MichaelW ,
You can update your encoded query something as below:
caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORwatch_listLIKEjavascript:gs.getUserID()
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 08:42 PM
Hi @MichaelW ,
You can update your encoded query something as below:
caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORwatch_listLIKEjavascript:gs.getUserID()
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 03:08 PM
Hi Aman,
Thanks you very much. Still testing but this seems to be working the way I wanted thanks. Modified a little to use a different caller field I have on all tables. Code below for reference if anyone else is looking.
(function executeRule(current, previous /*null when async*/) {
if (gs.hasRole('LMS Support')){
current.addEncodedQuery("u_who_forDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORwatch_listLIKEjavascript:gs.getUserID()");
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 09:31 PM
Actually it's affecting all users not just those that have that role 😞
I'm sure i'll get it there though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 10:11 AM
Were you able to get it resolved? I am also looking for something similiar