- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 04:39 AM
Hello,
we are importing users from our LDAP / Active Directory into our ServiceNow instance. Unfortunately we also need to import external, admin and other non-employee-users (to allow Service Requests, CI assignments, orchestration, etc.). Moreover, we still have > 10 Active Directories, which we are currently trying to harmonize into one Global AD, but we're not quite there yet.
However, if my IT colleagues now want to @mention one of the other infrastructure admins, they are presented with up to 14 different users (some admins have accounts in every LDAP) to choose from, which is very annoying and confusing. On most user reference fields, I have added a filter for u_employee_type == 'employee', but for my life I cannot find the correct spot where/how to filter the users specifically for the Activity Stream @mention Feature.
I hope that someone has a good idea!
Kind regards,
Lisa Holenstein
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 04:25 AM
I added an Infomessage, but it doesn't trigger on @mention. It triggers fine on picking a name in the email client ('EmailClient'), a pick field ('Reference') and so on, but it seems like the @mention is actually working differently.
gs.addInfoMessage('Variable ='+gs.action.getGlideURI().getMap().get('sysparm_processor'));
I used the BR for the email client anyways, it was a good tip, but unfortunately not solving my issue.
I did however find the correct condition in another community thread for disabling the @mention feature:
https://community.servicenow.com/message/1204758#1204758
gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/')
And that works just fine
Complete Business Rule:
On Before Query BR on Table "sys_user"
Condition: gs.getSession().isInteractive() && gs.action != ''
Script:
(function executeRule(current, previous /*null when async*/) {
try
{
if(gs.action.getGlideURI() != '')
{
if(gs.action.getGlideURI().getMap()!= '')
{
if(gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/'))
current.addEncodedQuery('u_employee_type!=admin^ORu_employee_typeISEMPTY');
current.addActiveQuery();
}
}
}
catch(errObj)
{
gs.error('Global_Set_Filter_Mention-'+errObj);
}
})(current, previous);
Thanks everyone!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 04:43 AM
I had done something like this for email client as I was in same situation with our users table.
Unlearn Series - Restrict Users On Email Client
You can reuse this and alter the parameters to fit your case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 01:41 AM
Thank you for your quick answer, I didn't get around to test it yet, but it looks very promising. Do you by chance know what the parameter would be called for @mention?
Kind regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 02:24 AM
I am not sure. You can add few logs for the gs.action thing in the script and set the parameter for that according to your result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 04:25 AM
I added an Infomessage, but it doesn't trigger on @mention. It triggers fine on picking a name in the email client ('EmailClient'), a pick field ('Reference') and so on, but it seems like the @mention is actually working differently.
gs.addInfoMessage('Variable ='+gs.action.getGlideURI().getMap().get('sysparm_processor'));
I used the BR for the email client anyways, it was a good tip, but unfortunately not solving my issue.
I did however find the correct condition in another community thread for disabling the @mention feature:
https://community.servicenow.com/message/1204758#1204758
gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/')
And that works just fine
Complete Business Rule:
On Before Query BR on Table "sys_user"
Condition: gs.getSession().isInteractive() && gs.action != ''
Script:
(function executeRule(current, previous /*null when async*/) {
try
{
if(gs.action.getGlideURI() != '')
{
if(gs.action.getGlideURI().getMap()!= '')
{
if(gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/'))
current.addEncodedQuery('u_employee_type!=admin^ORu_employee_typeISEMPTY');
current.addActiveQuery();
}
}
}
catch(errObj)
{
gs.error('Global_Set_Filter_Mention-'+errObj);
}
})(current, previous);
Thanks everyone!