Sending notification only to itil users of a particular company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 10:56 AM
Hi,
I have a notification configured on the Time Card Application which notifies users who have not submitted the time sheets. It sends out notifications to all the users in Servicenow on Monday irrespective of the user's company. That way, the notification has been sent out to all clients also which has become a problem.
Below is my notification:
I need to send that notification out only to itil users of my company. (not to everyone). Please guide me in solving this as I am newbie.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 11:02 AM
in the advanced condition of your notification you can script the condition of whether of not the user has itil role or not.
for reference:
Advanced conditions for email notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 12:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 02:30 PM
I would change the sys_user query at the beinning to this:
var userNoTimeCard = new GlideAggregate('sys_user_has_role');
var company = 'sys_id_of_company';
var role = '282bf1fac6112285017366cb5f867469';//oob itil role
userNoTimeCard.addEncodedQuery('user.company='+company+'^state=active');
userNoTimeCard.addQuery('role',role);
userNoTimeCard.groupBy('user');
userNoTimeCard.query();
while(userNoTimeCard.next()){
//enter the rest of your code here
//in the logic of your code just add 'user' after you reference the userNoTimeCard object.
//ie: line 4 you reference it like userNoTimeCard.userName.toString() that would change to userNoTimeCard.user.userName.toString()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2018 02:21 PM
any updates on if this worked?