- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 06:11 AM
Hi,
I have been exploring record visibility in Lists, so while working on it came across a scenario where i was trying to show records in retired state for some specific users (who are member of testing group).
- If user is not member of testing group, records with retired state should not be visible to them but records with other state should be visible.
- One of the approach i followed is - Created a table level Read ACL and added ACL script to check state and group membership. Based on these conditions returning answer.
- This approach works, but the issue is, If user is not member of testing group and there are records other than retired state and retired state in list, receiving error which says - security constraint prevents access. So there are records available in list but the mentioned error message also appears. This can mislead one, so trying to hide the unwanted records without any error message.
Can someone please suggest how this can be achieved? It will be helpful. Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 06:18 AM - edited ‎09-06-2023 06:19 AM
Hi @Vdevmat33
You can write before query business rule :
if ( !gs.getUser().isMemberOf("Testing group")) {
current.addEncodedQuery("state!=retired"); //you can use backend value for retired
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 06:18 AM - edited ‎09-06-2023 06:19 AM
Hi @Vdevmat33
You can write before query business rule :
if ( !gs.getUser().isMemberOf("Testing group")) {
current.addEncodedQuery("state!=retired"); //you can use backend value for retired
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 06:22 AM
Hi,
If you do not want the message you will have to go with Before query BR. Try using Vishal's script it might solve your issue.
Regards,
Badal Khojare
Community Rising Star 2023