restrict access to tickets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 10:39 AM
Hi All,
I am trying to restrict users from being able to read tickets if they are marked restricted(custom true/false field) unless they are member of the group the ticket is in or is the "requested for".
I believe the best method would be to use a on-before Query Business Rule however I am having trouble getting the "addQuery" right.
I want to do the following with addQuery rather than addEncodedQuery as the addEncodedQuery doesn't seem to work right in the script section.
Encoded Query: u_restrict=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORu_requested_forDYNAMIC90d1921e5f510100a9ad2572f2b477fe^NQu_restrict=false
is it possible to do this with an addQuery statement?
Any help would be appreciated.
Thanks,
Joshua Anderson
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 10:48 AM
Hi Joshua,
Please refer below blog and adjust your script. Let me know if you have any questions.
Controlling record access using 'Before Query' business rules - ServiceNow Guru

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 10:49 AM
Hi Joshua,
You've got the hard part done. If that list filter is giving you what you want, then try using
current.addEncodedQuery('u_restrict=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORu_requested_forDYNAMIC90d1921e5f510100a9ad2572f2b477fe^NQu_restrict=false');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 11:50 AM
Hey Chuck,
I actually tried that at first but ran into an issue...The Business Rule works when looking at a list of the incidents but if I click on an Incident, it always opens up INC0000001.
Any clue why this is happening?
Thanks,
Joshua Anderson

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 11:52 AM
Just to verify Joshua,
The same list brings up INC0000001, regardless of which row in the list you click?