Show incident rows only to the assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 07:04 AM
Hi,
Is there a way to define that only the assignment group could see her incident rows?
I tried to write an ACL:
Operation: read
script:
if(gs.getUser().isMemberOf(current.assignment_group))
{
answer=true;
}
else
{
answer=false;
}
however, the group members can't see any of the records (i attached a screenshot)
The member that i impersonated should have seen the first 3 rows
Also - I want the ones that are not in the assignment group to not see the records at all - instead of these empty records
Thank you in advance
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 01:47 AM
Hi Jaspal,
the records are not disply - the ones the user should see and the ones he souldn't
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 07:22 AM
Hi Shany,
I think when you have script section and it results to false it won't show data in that columns but it will show empty values.
Best way to do this is have before query business rule.
https://servicenowgems.com/2015/07/29/tip-for-creating-complex-before-query-business-rules/
What this will show only those records where assignment group belongs to user's group
Business rule condition: // this ensures that whenever this table is queried from any script the business rule won't run and won't restrict the records
gs.getSession().isInteractive()
Script:
var myUserObject = gs.getUser();
var myUserGroups = myUserObject.getMyGroups();
var groupsArray = new Array();
var it = myUserGroups.iterator();
var i=0;
while(it.hasNext()){
var myGroup = it.next();
groupsArray[i]=myGroup;
i++;
}
var qc = 'assignment_group.sys_idIN'+groupsArray;
current.addEncodedQuery(qc);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 01:47 AM
Hi Ankur,
I tried this business rule but nothing happends - the user can see all incidents,
I also tried the ones in the link
what can be the source of the problem?
Thank you