- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2025 06:13 AM
Hi everyone,
Based on a new incident record, both the Caller and the Opened by users should receive a notification. However, if either of them belongs to the Help Desk group, that user should not receive the notification.
Example:
If the Caller is part of the Help Desk group and Opened by is not, only the Opened by user should receive the notification — and vice versa.
How can we implement this logic?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2025 07:27 AM - edited 04-17-2025 07:29 AM
Hello @Paulo Machado
Below are the steps:
1. Create a system property for Help Desk Group sys_id (Table: sys_properties.LIST) --> Best practice to not hard code sys_id and have roles associated with the sys property
2. Create an Event (Table: sysevent_register)
3. Create email notification (Table: sysevent_email_action)
4. Create an insert Business Rule on Incident Table:
(function executeRule(current, previous /*null when async*/) {
var helpDeskGroupId = gs.getProperty('helpdesk.group.sysid');
function validateUserHelpDeskMembership(userId) {
var grUsr = new GlideRecord('sys_user_grmember');
grUsr.addQuery('user', userId);
grUsr.addQuery('group', helpDeskGroupId);
grUsr.query();
return grUsr.hasNext();
}
if (!current.caller_id || !current.opened_by) {
return;
}
var callerValidation = validateUserHelpDeskMembership(current.caller_id);
var openedByValidation = validateUserHelpDeskMembership(current.opened_by);
if (callerValidation && openedByValidation) {
gs.log('VJ1: Email will be sent to Opened By: ' + current.opened_by.email);
gs.eventQueue('incident.custom_notify', current, current.opened_by.email, '');
}
})(current, previous);
Validation Results:
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2025 09:07 AM
It's not working — the email was only sent to the caller, and the 'opened_by' didn't receive anything. Also, 'opened_by' is not a member of the Help Desk group.