- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 05:54 AM
Hello
I have a business rule setup on incidents which limit some ITIL users to only see tickets assigned to their assignment group:
Thanks
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2024 10:47 PM
Please use the below code and check if this works for you.
if (gs.getUser().isMemberOf('Group_Name')) {
current.addEncodedQuery("caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_group=group_sysid^ORwatch_listLIKEjavascript:gs.getUserID()");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:21 AM
Hello,
The script above gives me a syntax error, which I can only seem to get past by added } before the else if, but then this still doesn't work. The assignment groups work, but not the self-service of being able to see their own tickets when they are the caller.
if (gs.getUser().isMemberOf('Group_Name')) {
current.addEncodedQuery('numberISNOTEMPTY^assignment_group=group_sysid');
} else if
('caller_id=' + gs.getUserID() + '^ORwatch_listLIKE' + gs.getUserID());
current.addEncodedQuery('numberISNOTEMPTY');
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:26 AM
if (gs.getUser().isMemberOf('Group_Name')) current.addEncodedQuery('numberISNOTEMPTY^assignment_group=group_sysid'); else if ('caller_id=' + gs.getUserID() + '^ORwatch_listLIKE' + gs.getUserID()); current.addEncodedQuery('numberISNOTEMPTY'); })(current, previous);
Managed to get rid of the syntax error and the { } but I have the same issue with script above. Tickets are still locked down by assignment group, but I am unable to see tickets when they are the caller still.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 05:13 AM
Why not add the condition to the query?
(function executeRule(current, previous /*null when async*/) {
if (gs.getUser().isMemberOf('Group_Name')) {
current.addEncodedQuery('numberISNOTEMPTY^assignment_group=group_sysid');
} else {
current.addEncodedQuery('numberISNOTEMPTY^caller_id=' + gs.getUserID() + '^ORwatch_listLIKE' + gs.getUserID());
}
})(current, previous);
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 05:27 AM
Hi Abbie,
Could you please just try this below code.
(function executeRule(current, previous /*null when async*/) {
current.addEncodedQuery("caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORwatch_listLIKEjavascript:gs.getUserID()");
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 08:49 AM
That works if I want to restrict everyone's access, but I only want to restrict a specific assignment group.
I have one assignment group who are only allowed to see their own tickets: this includes tickets where they are the caller or tickets assigned to the assignment group they are a member of.
All other ITIL users in other assignment groups, apart from the one above, should be able to continue to see all tickets.