- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 10:59 AM
I have a requirement to test limiting the scope of what each Assignment Group can see.
I have managed to get this to work for Incidents, limiting to only see Incidents that they are the customer, or on the watchlist, or Incidents assigned to their 'Assignment Group' field on the Incident Record
I have managed to get this to work in the same manner for SC_Tasks
However, i haven't found a way to propagate that upward through the RITM and REQ level, we do not have the 'Assignment Group' field on those records and there is no desire to add it
Is it possible to script this in my BR?
Pseudo:
Can view REQ = True
Can view RITM = True
IF i am the customer
IF i am the creator
IF RITM contains SC_TASK where 'Assignment Group' is DYNAMIC 'one of my groups'
IF REQ contains RITM containing SC_TASK where 'Assignment Group' is DYNAMIC 'one of my groups'
Here is my current BR code running on SC_TASK
Condition:
!gs.hasRole('admin')||gs.getUser().isMemberOf("IS-SECURITY-BADGES")
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getSession().isInteractive()) {
//Restrict to caller, watchlist, or members of assigned group...
var u = gs.getUserID(); //Get the sys_id value of the current user
var g = getMyGroups(); //Get the list of the current user groups
var q = current.addQuery('request.requested_for', u).addOrCondition('assignment_group', g).addOrCondition('watch_list', 'CONTAINS', u); //Modify the current query on the sc_task table
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- 2,244 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 01:02 PM
I don't think this is possible (I'm assuming this would be a query Business Rule-QBR). For two reasons:
1. while related list queries are possible using RLQUERY (see Encoded query strings - towards the bottom of the page) it can only be AND-ed, not OR-ed with other conditions.
2. it messes up list filters as those cannot "express" the RLQUERY part and messes up other QBRs that count on such complications NOT being present.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 01:02 PM
I don't think this is possible (I'm assuming this would be a query Business Rule-QBR). For two reasons:
1. while related list queries are possible using RLQUERY (see Encoded query strings - towards the bottom of the page) it can only be AND-ed, not OR-ed with other conditions.
2. it messes up list filters as those cannot "express" the RLQUERY part and messes up other QBRs that count on such complications NOT being present.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:34 PM
Gotcha, are you also saying that we should not go ahead with this for Incident or SC_Task like we have been testing? Is there a chance that it will break other related list filters if we were to do that?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2022 10:37 AM
No, sc_task and incident are fine, cause in those cases you can add the filtering using "regular" filters, which will play nice in the list filters and will not misbehave in case other QBRs will crop up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2022 05:05 PM
Thank you, i appreciate the feedback!