
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2019 07:47 AM
Hello, I have a requirement to hide incidents with a specific subcategory from anybody who does not have a specific user role: incident_security. The subcategory in the choice list has to also be hidden from any user without user role: incident_security.
This has to be done for two different subcategories.
- Miscellaneous Security Incident
- Security Investigation
I have done this successfully for the Miscellaneous Security Incident subcategory but I cannot successfully do this with the Security Investigation subcategory.
Step 1: Hide subcat from choice list on incident form using client script:
Step 2: add READ ACL to incident table with condition "subcategory=xyz" for incident_security role:
When I do the exact same thing for subcategory #2 (security investigation), the client script works (subcat is not visible in choice list for non incident_security users) but the incidents are still visible on the incident table list view.
What am I doing wrong?
I tried combining both subcategory conditions into one ACL and it didn't work, so I'm unsure what I may be doing wrong with this.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 08:30 AM
Hi Chase,
Sorry to hear about this - does the rule only need to apply to ITIL users and not customers?
If so, I would recommend adjusting the initial if statement to include a check for the ITIL role, like this:
if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
With regards to the subcategory of none not being displayed, could you try adding an or statement that shows items that are empty - best way to do this is to adjust the addQuery to be an addEncodedQuery, this works like this:
if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
current.addEncodedQuery("subcategoryNOT INSecurity Investigation,Miscellaneous Security Incident^ORsubcategoryISEMPTY");
}
This will tell the system to display items that don't contain Security Investigation and Miscellaneous Security Incident but show items that have empty values.
I hope this helps and if you have any questions, do ask.
[Edited 16:55 GMT]
Sorry, just edited the encoded query, noticed the ISEMPTY statement was an and (^) rather than an or (^OR).
Regards,
Jamie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 08:30 AM
Hi Chase,
Sorry to hear about this - does the rule only need to apply to ITIL users and not customers?
If so, I would recommend adjusting the initial if statement to include a check for the ITIL role, like this:
if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
With regards to the subcategory of none not being displayed, could you try adding an or statement that shows items that are empty - best way to do this is to adjust the addQuery to be an addEncodedQuery, this works like this:
if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
current.addEncodedQuery("subcategoryNOT INSecurity Investigation,Miscellaneous Security Incident^ORsubcategoryISEMPTY");
}
This will tell the system to display items that don't contain Security Investigation and Miscellaneous Security Incident but show items that have empty values.
I hope this helps and if you have any questions, do ask.
[Edited 16:55 GMT]
Sorry, just edited the encoded query, noticed the ISEMPTY statement was an and (^) rather than an or (^OR).
Regards,
Jamie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 01:33 PM
Jamie,
I tried the edited encodedquery script you provided and it appears to be working with no downsides. Thank you very much for this, I appreciate your willingness to help.