How to restrict a specific group incidents to only its group members and to caller servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 12:33 AM - edited ‎09-19-2024 12:42 AM
I would like to restrict a specific group incidents to only its group members and to caller servicenow. I tried below script and I can able to see incidents when I'm part of a specific group but for caller I cannot able to see incident.
It's working for specific group members but not to caller. Please someone help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 01:05 AM
Hi @Sanjay Kumar10,
I believe this is a snippet from a 'Query' Business Rule - correct? Please confirm. If so, this is the approach I would also take and will provide the functionality you require.
What I am not able to see an .addOrCondition for the caller_id field?
Can you provide the full code and the screen shot does not show everything.
I would expect something similar to the below as well as your existing group check logic:
// in addition to your current group log check
var userID = gs.getUserID(); // variable to store current logged in user
.addOrCondition("caller_id", userID)
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 01:09 AM
Hello Robbie,
Yes, It's a before query business rule. Sure below is the code.
Under Condition field, I kept below condition
!gs.getUser().isMemberOf('b39adf721bb63010ee5a8408624bcb89') || gs.getUserID()!= current.caller_id.getValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:49 AM
Hi @Sanjay Kumar10,
Have you tried adding the .addOrCondition to your query business rule (not forgetting to also add the variable for the userID) as per my response?
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie