Limiting @mention functionality
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-15-2023 02:13 AM
I've been inspecting how the @Mention works and based on transactions it's based on some API path "/api/now/form/mention/record/...".
I created a before query BR in sys_user table to limit the users returned by the mention and it seems to work in most cases, but there are cases when a user can be mentioned even though they do get filtered out by the query.
Here's an example.
My BR blocks users from company "X" if "gs.action.getGlideURI" contains "api/now/form/mention".
I go to demand table and open a record. There's a "Opened by" user "U" who is from company "X". If I start writing the users's name in mention they show up and I can select them. If I go to another record the user won't show there.
I tried removing the user from the "Opened by" field and event changed the "Created by" value, but user U is still available for selection on the first demand.
Why? What does Servicenow do in the background that would prevent query rule form triggering for a user in this case? How can I block this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-15-2023 04:45 AM
Is your rule the one listed on this post?
https://www.servicenow.com/community/developer-forum/filter-mention-for-work-notes/m-p/2163074
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-15-2023 05:10 AM
Similar at least.
(function executeRule(current, previous /*null when async*/ ) {
try {
if (gs.action.getGlideURI().toString().indexOf('api/now/form/mention/record') > -1) {
var query = 'company=78ef6fbcdbe722002f9ebc2ffe961954^active=true';
current.addQuery(query);
}
} catch (err) {
//no logging
}
})(current, previous);
Before query on sys_user table. I haven't included any other conditions, so it runs for every query.