Business Rule to restrict visibility of Incidents to assignment group members, caller, watchlist

Renee16
Tera Contributor

Requirement: Incidents that are assigned to "IT - Enhancements" to only be visible to members of the IT Enhancements assignment group, the caller, users on the watch list and admins. Other itil users cannot see these tickets unless the ticket is no longer assigned to IT - Enhancements group.

 

I have somewhat achieved this through a business rule before query to lock down to members of the IT - Enhancements group.

Renee16_1-1713435364570.png

 

I now want to add Admin, Caller and Watch list to this, i have tried to add the following in the condition but this did not allow the caller to see the ticket in the portal 

!gs.getUser().isMemberOf('IT - Enhancements') || current.caller_id != gs.getUser() || !current.watch_list.toString().split(';').includes(gs.getUser()

 

I tried without the watchlist and just had just current caller id

!gs.getUser().isMemberOf('IT - Enhancements') && current.caller_id != gs.getUser()

 

I have used OR || and also && but nothing seems to work to allow Caller, Watch list and Admin to see the ticket as well any help would be appreciated?

 

10 REPLIES 10

Amit Pandey
Kilo Sage

Hi @Renee16 

 

Can you check this-

 

!gs.getUser().isMemberOf('IT - Enhancements') && (current.caller_id != gs.getUserID() && (current.watch_list.nil() || current.watch_list.toString().split(';').indexOf(gs.getUserID()) == -1) && !gs.hasRole('admin')) 

 

Regards,

Amit

 

Thanks for the quick response here are the results

Admin can see it now - good

Members of the group can see it - good

Other itil users cannot see it  - good

 

Caller still cannot see the record 

Renee16_0-1713436009897.png

Users on the Watch List cannot see it 

Renee16_0-1713436009897.png

 

Hi @Renee16 

 

Can you try this once-

 

!gs.getUser().isMemberOf('IT - Enhancements') &&(current.caller_id == gs.getUserID() || (current.watch_list.nil() || current.watch_list.toString().split(';').indexOf(gs.getUserID()) != -1) || gs.hasRole('admin'))

This one has made the ticket visible to all again including the other itil users who shouldn't have access.