- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 09:13 AM
i am trying to setup an ACL to allow members of the Parent Group the ability to READ work notes. The Parent Group has many child groups.
I have been trying and already expelled many hours, which to me would be a simple to do.
1. The members of the parent group should see work notes on all tickets of which are assigned to their child groups.
2. The members of the assignment group on the ticket should see work notes.
3. Other child groups that are not listed as the Assignment Group on the ticket should NOT see work notes.
Please help, Thanks
ps. Members of the parent are not in any of the child groups.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 11:19 AM
Hi, I think all you need to do is push the group sys_id's into an array and then check to see if the logged in user has a relationship to one of them.
untested code and the syntax may be a bit wobbly but you could try something like this
var answer = false;
var myGroups = [];
var myUser = gs.getUserID();
myGroups.push(current.assignment_group.sys_id);
myGroups.push(current.assignment_group.parent.sys_id);
var recCheck = new GlideRecord('sys_user_grmember');
recCheck.addQuery('user', myUser);
recCheck.addQuery('group', 'IN', myGroups.toString());
reCheck.query();
if(recCheck.next()) {
answer = true;
}
return answer;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 11:19 AM
Hi, I think all you need to do is push the group sys_id's into an array and then check to see if the logged in user has a relationship to one of them.
untested code and the syntax may be a bit wobbly but you could try something like this
var answer = false;
var myGroups = [];
var myUser = gs.getUserID();
myGroups.push(current.assignment_group.sys_id);
myGroups.push(current.assignment_group.parent.sys_id);
var recCheck = new GlideRecord('sys_user_grmember');
recCheck.addQuery('user', myUser);
recCheck.addQuery('group', 'IN', myGroups.toString());
reCheck.query();
if(recCheck.next()) {
answer = true;
}
return answer;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2020 04:08 AM
Tony, the script worked. I didn't at first, since I did a copy/paste I didn't analyze the coding. You misspelled the .query line. Once i fixed that line, it worked like a charm. you have reCheck, should have been recCheck.query().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 12:28 PM
Thanks, I'm to fix the wobble. At least I have something to go on. Thanks again. Will advise once I get the wobble unwobbled.