- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 03:55 AM - edited ‎12-30-2024 03:56 AM
I've created a "READ" access control which has worked...ish. For some reason its now showing a blank placeholder where the record should be, any ideas how I can just remove this completely?
I did try and configure it instead however the dynamic "is one of my groups" didnt seem to work so had to go down the scripting route.
Script condition
answer = true;
if (current.u_nda) {
var group = current.u_authorized_group;
if (!gs.getUser().isMemberOf(group)) {
answer = false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 05:44 AM - edited ‎01-02-2025 05:45 AM
Hey all, I managed to get it working using "addEncodedQuery()" which is actually really simple.
//When to run: Before
//Order: 1000
// Query: True
(function executeRule(current, previous) {
var query = '';
query = "u_authorized_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORu_authorized_groupISEMPTY";
current.addEncodedQuery(query);
})(current, previous);
Thank you everyone for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 04:01 AM
Hi @Andrew_TND try below script
answer = true;
if (current.u_nda) {
var group = current.u_authorized_group;
if (group && !gs.getUser().isMemberOf(group)) {
answer = false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 04:08 AM
you should also give table.None READ ACL
What should happen if that group is empty?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 04:10 AM
is one of my groups should work fine provided that field holds a reference to group table
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 04:33 AM
Hi @Harish Bainsla & @Ankur Bawiskar, the script doesnt seem to have any issues its more the blank row it generates if a record is being hidden if you know a way to remedy that?