Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Script to exclude Caller from restricted view of Assignment group incidents

tpalamore
Tera Contributor

I am using the below Business Rule script to block view of incidents assigned to a specific groups from other users that are not in that group. This is causing an error message for the caller.

What line needs to be added to exclude the block from caller, to where the caller can see their submitted incident?

 

Condition: !gs.getUser().isMemberOf('ServiceNow - HR');

 

Script:

(function executeRule(current, previous /*null when async*/ ) {
var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','5655ec7b47716a10661782b5536d43c7');
})(current, previous);
5 REPLIES 5

surajit3
Tera Expert

You can add on current.caller_id is not logged in user either in condition or put an if inside your script