Need to trigger notification when ITIL license beyond limit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 08:11 AM
Hi
I have requirement,
When the ITIL license limit exeeds, i need to trigger notification to specific user.
Can any one help me, please provide notification conditions.
Eg: ITIL aggreed license for my instance is 70 users, If ITIL users more then 70 i need to send notification to specific users.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 08:33 AM
There are many ways to do this, some examples:
- Reports
- You could run a scheduled job weekly that does a count for the how many users have ITIL and triggers a notification event
- Business rule when 'sys_user_has_role_list' record is created/update and role.name is ITIL and triggers a notification event
- Modern approach - Flow designer - Trigger when ''sys_user_has_role_list' record is created/update and role.name is ITIL. Have the flow contain a notification and use the flow variables to direct it to the appropriate users
I would:
Create notification that will be sent when conditions are met.
Create an Event that sends the notification.
Create a business rule that runs a script to get the count:
Script:
var user = new GlideRecord('sys_user');
user.addActiveQuery();
user.query();
var count = 0;
while(user.next()){
var role = new GlideRecord('sys_user_has_role');
role.addQuery('user', user.sys_id);
role.addQuery('role.name', 'itil');
role.query();
if(role.hasNext()){
count++;
}
}
gs.print(count);
if(count > 69){
//trigger event
//gs.eventQueue(NOTIFICATION EVENT...);
}
If the count reaches a number that you deem as too high, trigger an event that sends the notification to the user using gs event queue and user details from the script. This approach may be quite demanding performance wise as it queries the entire user table.
Please mark answer as helpful/correct based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 07:35 AM
Hi prasad, glad this was helpful, have you got a follow up query? If not could you accept the answer