How to set field should be editable to specific users, role and group?

Shraddha desai
Tera Contributor

Hello,

 

We want 'priority'  field should be editable to following member.

Admin

assignment group member
assigned to member

Created by member
requested by member

How can we do this by ACL?

 

If  their is any other option please let us know 

 

Thank You!

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Shraddha desai Though you didn't mention the table name but I am assuming it is a sc_req_item table with a custom field requested by. Here is how you should configure your ACL.

 

Screenshot 2023-04-29 at 8.47.19 PM.pngScreenshot 2023-04-29 at 8.47.26 PM.png

Here is the script.

answer = false;
if (gs.getUser().hasRole('admin') || gs.getUser().isMemberOf(current.assignment_group.getDisplayValue()) || gs.getUserID() == current.assigned_to || gs.getUserID() == current.sys_created_by || gs.getUserID() == current.u_requested_by) {
    answer = true;
}

Here I have assumed that u_requested_by is a custom field representing Requested by. Please update it according to your field name.

 

Also, with Admin override no separate role checking is needed but still I put the role check for admin in script just in case if you wish to uncheck admin override checkbox.

 

Hope this helps.

View solution in original post

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@Shraddha desai Though you didn't mention the table name but I am assuming it is a sc_req_item table with a custom field requested by. Here is how you should configure your ACL.

 

Screenshot 2023-04-29 at 8.47.19 PM.pngScreenshot 2023-04-29 at 8.47.26 PM.png

Here is the script.

answer = false;
if (gs.getUser().hasRole('admin') || gs.getUser().isMemberOf(current.assignment_group.getDisplayValue()) || gs.getUserID() == current.assigned_to || gs.getUserID() == current.sys_created_by || gs.getUserID() == current.u_requested_by) {
    answer = true;
}

Here I have assumed that u_requested_by is a custom field representing Requested by. Please update it according to your field name.

 

Also, with Admin override no separate role checking is needed but still I put the role check for admin in script just in case if you wish to uncheck admin override checkbox.

 

Hope this helps.

Ramkumar Thanga
Mega Sage

Hi !!

Create an ACL for the field priority.

Select adminoverrides to make admin to override the rule.

 

And use the below script.

 

var user = gs.getUserID();
if (gs.getUser().isMemberOf(current.assignment_group.name && user == current.assigned_to && user == current.created_by && user == current.requested_by)) {
answer = true;
}

Karan Chhabra6
Mega Sage
Mega Sage

Hi @Shraddha desai ,

You can create a write ACL on the 'prioriy' field, select the 'admin overrides' & 'advanced' checkbox 

KaranChhabra6_0-1682781699502.png

 

The ACL script is as follows, please double check the field names

if (gs.getUser().isMemberOf(current.assignment_group) || (gs.getUserID() == current.assigned_to) || (gs.getUserID() == current.created_by) || (gs.getUserID() == current.requested_by)) {
    answer = true;
} else {
    answer = false;
}

 

If my answer has helped with your question, please mark it as correct and helpful solution.

 

Thanks!