
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2022 10:49 PM - edited 12-25-2022 10:55 PM
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;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2022 12:46 AM
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2022 12:37 AM
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;
}
}
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2022 12:46 AM
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.
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.