How to restrict records to users based on roles and state

kalyani23
Tera Contributor

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

 

18 REPLIES 18

Hi,

the condition as state is draft not working , the addquery code is working . can u help to fix this .

Thanks in advance

Sohail Khilji
Kilo Patron
Kilo Patron

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....

LinkedIn - Lets Connect

SunilKumar_P
Giga Sage

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

 

SunilKumar_P_0-1707297215814.png

 

 

Regards,

Sunil

Dr Atul G- LNG
Tera Patron
Tera Patron

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]

****************************************************************************************************************