How to filter users for Activity Stream @mention
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2020 12:21 PM
How to filter users for Activity Stream @mention, we want to hide admin accounts when user mention @.
- Labels:
-
Service Desk
- 2,615 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2020 01:00 PM
Can you provide more details? What do you mean by hide? Just remove them from the list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2020 01:13 PM
when user seached in work notes by using @mentions then he shouldn't see admin accounts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2020 07:40 AM
I too have been looking for an answer to this problem. All active users appear to be retrieved, and we have a need to omit any users that are not tied to the current user's company.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2020 08:19 AM
I found the answer! Inspired by the post here: https://community.servicenow.com/community?id=community_question&sys_id=6cec4b29db9cdbc01dcaf3231f96...
I created a Before Query business rule on the sys_user table the below logic. It will only trigger if the query is coming from an @mention:
(function executeRule(current, previous /*null when async*/ ) {
var query = 'active=true^roles!=admin'; //filter out admin users in @mention
try {
if (gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/')) {
current.addEncodedQuery(query);
}
} catch (err) {
gs.log("@mention Filter Runtime Error: " + err);
}
})(current, previous);
This will show all users who are not an admin, including users without a role, so the query string may need to be refined more for your specific needs.