Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

ACL Script

Not applicable
  • Modify the existing “write” ACL on the Provider table to allow ONLY users from the "Owned by group" to edit the Provider records

  • Owned by group has members only the members can change the provider.

My Script:

 

var result = false;


var list = current.owned_by_group.toString().split(',');


for (var i = 0; i < list.length; i++) {


var grp = new GlideRecord('sys_user_group');


grp.get(list[i]);


if (gs.getUser().isMemberOf(grp.getDisplayValue())){
result = true;

break;


}
}

 

 

answer = result;

 

1 ACCEPTED SOLUTION

Taha Habib
Tera Guru

Hello Abdul, I believe the last if condition alone is enough to complete your requirement. I am assuming you have a group called "owned by group", which has some users in it, and you want only those users to write to the record. I have replicated the requirement in my personal Instance, it is working fine with the below script. Please have a look at it.

 

Also make sure, the users should have the user role of your table. 

TahaHabib_0-1672044156036.png

 

Use the following script in your write ACL:

 

answer=false;
if(gs.getUser().isMemberOf("owned_by_group"))
{
   
  answer=true;
}

 

If the above information helps you with your requirement, please mark this solution as helpful and correct. Thank you.

View solution in original post

2 REPLIES 2

Raghav Sharma24
Giga Patron

try below:

 

answer=false;


var list = current.owned_by_group.toString().split(',');


for (var i = 0; i < list.length; i++) {

if (gs.getUser().isMemberOf(list[i])){
answer=true;

break;

}
}

Taha Habib
Tera Guru

Hello Abdul, I believe the last if condition alone is enough to complete your requirement. I am assuming you have a group called "owned by group", which has some users in it, and you want only those users to write to the record. I have replicated the requirement in my personal Instance, it is working fine with the below script. Please have a look at it.

 

Also make sure, the users should have the user role of your table. 

TahaHabib_0-1672044156036.png

 

Use the following script in your write ACL:

 

answer=false;
if(gs.getUser().isMemberOf("owned_by_group"))
{
   
  answer=true;
}

 

If the above information helps you with your requirement, please mark this solution as helpful and correct. Thank you.