- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 07:35 AM
Hello
Im getting lost in scripting ACL
What I need is to create ACL where:
User can see only tickets where user is member of group to which ticket is either assigned or watchlisted
Anyone know how to do it?
With the below script Im not getting correct results for READ ACL.
See it below, it should give me back 6 records to read and it giving me back just 3, why ?
please help
/Petr
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 07:59 AM
As noted before, try it with one ACL criteria and two ACLs. Debug the one to determine group membership first. Test it, get it working, etc. If someone comes along later and says "No, we don't need that" it's a simple matter of deactivating it rather than modifying code. Don't pile both bits of logic in one ACL.
ACL 1:
answer = gs.getUser().isMemberOf(current.u_assignment_group.getDisplayValue());
ACL 2:
var result = false;
var list = current.u_support_team_involved.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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 07:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 08:37 AM
Can you show us both of the ACLs? It might be the way they are interacting?
Are there any other relevant ACLs that already exist?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 08:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 08:53 AM
Ulrich, with this ACL code I now see all tickets, but they are hidden under different lists
Why they are not under list 1 as list is set to 10 rows and it display just 6 records ?
Is this common behaviour?
List 1 display 6 tickets
List 2 display 0 tickets
List 3 display 1 ticket
List 4 display 1 ticket
List 5 display 2 tickets
List 6 display 1 ticket
All in all 11 in total which is now correct.
images below
/Petr

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 08:57 AM
Repeating on my previous post in this thread:
Are you sure you scrolled through all of the pages in the list view?
>> Apparently now you finally did 🙂
You see that there is a Security constraint message, which comes when you don't have access to the records (from an ACL). I would assume that you will find your 6 records when you click through the different pages.
>> This is expected behaviour
To avoid the Security constraint message, you can create a on Query Business Rule, which runs a similar query like your ACL
>> check documentation here: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/script/business-rules/concept/c_...