Need help on creating notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 03:28 AM
Requirement is when incident sla (Business elapsed percentage is greater then 75%) and when incident assignment group is ABC1 or ABC2, email should trigger to particular users + incident assignment group(only which group members have title as contractor)
Could you please help me on this requirement?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 04:44 AM
then please use event based approach, and get the group members with that title and include in eventQueue() parm1
In notification ensure "Event parm1 contains recipient" is true
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 04:53 AM
Hi @Ankur Bawiskar ,
I have created this business rule, but this is not working. I also called in notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 05:35 AM
your event, notification is on which table?
I hope it's on task_sla table
Ensure "Event parm2 contains recipient" is TRUE on notification record
Also this line is wrong -> what is validGroups? what does this mean?
if (current.taskslatable_business_percentage > 1 && validGroups.indexOf(taskGroup) !== -1) {
(function executeRule(current, previous /*null when async*/ ) {
// Validate conditions: Business percentage > 2 AND Assignment Group is in the specified list
var taskGroup = current.task.assignment_group.getDisplayValue(); // Get group name
if (current.taskslatable_business_percentage > 1 && validGroups.indexOf(taskGroup) !== -1) {
var arrUsers = [];
// Querying users with title 'Contractor' in the specific assignment group
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', current.task.assignment_group);
grMember.query();
while (grMember.next()) {
var userRecord = new GlideRecord('sys_user');
userRecord.get(grMember.user);
if (userRecord.title.toString() == 'Contractor') {
arrUsers.push(userRecord.email.toString()); // Get the user's email instead of sys_id
}
}
// Check if we have users to notify
if (arrUsers.length > 0) {
var emailUsers = arrUsers.join(',');
// Trigger custom event for notification
gs.eventQueue('sla.75percent.notification', current, current.task.assignment_group.sys_id, emailUsers);
}
gs.log('testing');
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 04:47 AM
Hi @Ankur Bawiskar ,
This script is not working, I also followed the steps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 05:04 AM
sorry but we can only guide and provide scripts which you need to enhance further.
What enhancement you performed?
I already informed what changes are required and the probable issue
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader