How to restrict records to users based on roles and state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 11:20 PM
Hi,
I need to restrict draft state records to users, when the logged in user is not the requestor.
how to achieve this using acls. please let me know
Thanks in advance,
Kalyani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 12:50 AM
Hi,
the condition as state is draft not working , the addquery code is working . can u help to fix this .
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 12:28 AM - edited 02-07-2024 12:29 AM
you can use query business rule for this.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 01:13 AM
Hi @kalyani23, we can also restrict record from visibility via before-query business rule. Below is the example of restrciting the Incidents visibility where the Incidents are closed and caller is not logged in user.
Condition:
current.caller_id!=gs.getUserID()
Script:
(function executeRule(current, previous /*null when async*/ ) {
var grpQuery = 'state!=7^ORstate=NULL';
current.addEncodedQuery(grpQuery);
})(current, previous);
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 02:20 AM
Hi @kalyani23
I am not coder but I have question
I need to restrict draft state records to users, when the logged in user is not the requestor.
Atul: So you need one a user logged in and if his/her name not in Requestor that in state field Draft state not visible?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************