ACL for a particular field

utkarsh6
Giga Contributor

Hi @Ankur Bawiskar / team,

need your help to implement an ACL with the logic as -

I have created a new field " xyz" with a checkbox on a particular form using type true/false. My form is having three fields as support manager, responsible manager and a support group. 

Now the requirement here is the newly created field with the checkbox can be checked or unchecked only by the support manager , responsible manger or any member of that support group that a form is having. For other users it should be a read only field..

pls help how can I proceed with this.  I know we can do via write ACL but help with the script and logic for the reference.

Thanks

 

8 REPLIES 8

Sourabh26
Giga Guru

Hi,

 

You can use the below logic.

 

 

  1. Create a role for the users how can have access to that field.
  2. Assign the roles to the related users (ex. support manager)
  3. Configure the ACL as 

          for read and write both

          Tablename.fieldname (here field is "xyz")

          add the role (which has created above) in this ACL

 

Note : The users should to have the table level access.

 

Mark this as Correct/Helpful in case this helps you in anyways.

 

Regards,

Sourabh

Vaishnavi Lathk
Mega Sage
Mega Sage

Hi,

 

You can implement a Write ACl on Incident table at the field level with the below script as:

1)ACL Type :- Write Acl

2)Condition :- Table Name. Field Name

3)Role:- if any role is mandatory

4)Code snippet

if(gs.getUser().isMemberOf('SupportGroupName')) {

  answer = true;

}

else{

answer = false;

}

 

 

Hope this helps. Mark the answer as correct/helpful based on impact.

 

Saurav11
Kilo Patron
Kilo Patron

Hello Utkarsh,

Pleas use the below script on your write ACL for table.fieldname

answer = checkbox();

function checkbox() {
var user=gs.getUserID();
var grp=current.support group;
if(gs.getUser().isMemberOf(current.support group) || current.responsible_manager==user || current.support_manager == user) {
return true;
}else{
return false;
}
}

 

Please mark answer correct/helpful based on impact.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So you can have field level WRITE ACL on that field for your table

Advanced - True

Script

answer = gs.getUser().isMemberOf(current.support_group) || current.responsible_manager == gs.getUserID() || current.support_manager == gs.getUserID();

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader