- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
01-29-2025 01:41 AM - edited 01-29-2025 01:44 AM
Hi All,
Looking for some expertise on an issue.
Context: We've onboarded a team into servicenow - they have their own table but use itil role and have a custom role.
I've been asked to hide the incident table contents from their assignment groups - i've been able to achieve this using a before business rule query script below :
Solved! Go to Solution.
- Labels:
 - 
						
							
		
			Security
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
01-29-2025 02:16 AM
try this and use OR condition
(function executeRule(current, previous /*null when async*/) {
    if (gs.getUser().isMemberOf('sys_id of group') && gs.getSession().isInteractive()) {
        var userID = gs.getUserID();
        var qc = current.addQuery('assignment_group', 'sys_id of group');
        qc.addOrCondition('caller_id', userID);
        qc.addOrCondition('opened_by', userID);
    } else {
        return;
    }
})(current, previous);
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
 
01-29-2025 02:16 AM
try this and use OR condition
(function executeRule(current, previous /*null when async*/) {
    if (gs.getUser().isMemberOf('sys_id of group') && gs.getSession().isInteractive()) {
        var userID = gs.getUserID();
        var qc = current.addQuery('assignment_group', 'sys_id of group');
        qc.addOrCondition('caller_id', userID);
        qc.addOrCondition('opened_by', userID);
    } else {
        return;
    }
})(current, previous);
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
 
01-29-2025 03:05 AM
legend, thanks for sending this across exactly what i needed
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
01-29-2025 03:07 AM
Glad to help
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
