Limit visibility of Assignment Groups to see only their assigned RITM and REQ

Russell Abbott
Kilo Sage

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);
1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

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.

View solution in original post

13 REPLIES 13

-O-
Kilo Patron
Kilo Patron

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.

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

 

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.

Thank you, i appreciate the feedback!