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

Danish Bhairag2
Tera Sage
Tera Sage

Hi @kalyani23 ,

 

You can create a Read ACL on the relevant table n under that put condition as state is draft & under script section use below script

 

if(gs.getUserID() == current.requested_by){ // plz modify requested by field name as per ur need but make sure its reference
answer = true;
}

 

Thanks,

Danish

 

 

siva krishna M2
Tera Guru

Hello @kalyani23 ,

 

Kindly check all the read acl's on the table and add below script to all the acl's then it will work

 

var b = current.requested_for  // if requested_for is the field value of requestor

var k = current.state;

if(k=="draft choice value" && gs.getUserID()==b)

{

answer=true;
}

 

If it helps, Kindy click on like icon and mark it as accepted solution

Harish KM
Kilo Patron
Kilo Patron

Hi @kalyani23 first you need to review OOB Read ACL;s which is giving access and then update it accordingly

with condition

state is draft

script:

if(current.fieldName == gs.getUserID())

answer = true;

Regards
Harish

Hi Harish,

 do i need to change it in oob read acl or create new read acl .

 

thanks.