Restrict read access for some account numbers

Community Alums
Not applicable

Hi all, 

I need to restrict "read" access for approximately 3000 account numbers(for which I have an encoded query)  to users who possess the “sn_customerservice_agent” role. Obviously they need to be able to see the rest of the accounts.

 

Could anyone suggest the most efficient approach to achieve this? I would greatly appreciate any recommendations or example scripts. Thank you

1 ACCEPTED SOLUTION

@Community Alums add a checkbox field DuplicateAccount on your accounts table and set the value of of this field to true for all duplicate account accounts.

 

In your query BR for account table you can simply use the following query.

 

current.addEncodedQuery('u_duplicate_account',false);

Hope this helps.

View solution in original post

7 REPLIES 7

Sandeep Rajput
Tera Patron
Tera Patron

@Community Alums You should use a query business rule in this case. In the condition field of the query business rule you can check if the user has sn_customerservice_agent role. Using current.addQuery() you can add encoded query to filter the records.

 

To know more about query business rule please refer to https://docs.servicenow.com/bundle/washingtondc-platform-security/page/administer/company-and-domain-separation/concept/bp-before-query-business-rules.html

 

https://www.servicenow.com/community/developer-blog/query-business-rules-a-definitive-guide/ba-p/2276867

 

Hope this helps.

Community Alums
Not applicable

Hi @Sandeep Rajput 

Hi @Sandeep Rajput , thanks for this. Because the table is "customer_account" I cannot create a filter condition to check if user has the role. 

What I need is  "The 3000 account numbers records, will have to be hidden in the list view for all the users that have the sn_customerservice_agent role"

Is this achievable thruogh a query business rule you mentioned above? if yes how can I create the BR script? thanks

@Community Alums Yes this is achievable through query business rule. What exactly is the criteria to exclude those 3000 account? Do they belong to specific customer?

Community Alums
Not applicable

@Sandeep Rajput  No, they are duplicates, in fact the encoded query is pretty long as it shows all the record numbers.