restrict access to tickets

jna2756
Tera Expert

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

find_real_file.png

is it possible to do this with an addQuery statement?

Any help would be appreciated.

Thanks,

Joshua Anderson

23 REPLIES 23

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

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


Chuck Tomasi
Tera Patron

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');




GlideRecord - ServiceNow Wiki


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


Just to verify Joshua,



The same list brings up INC0000001, regardless of which row in the list you click?