Notification

sparkles
Tera Contributor

Hello!

I need to send notification to the (assigned to) on (incident task) whenever the incident got updated.

How do I do that?

 

Thanks,

S

5 REPLIES 5

Maik Skoddow
Tera Patron
Tera Patron

Hi @sparkles 

 

To send a notification to the Assigned To user on an Incident Task whenever the related Incident is updated in ServiceNow, you can follow these steps:

 

1. Create a Business Rule on the Incident Table

  • Navigate to System Definition > Business Rules.

  • Create a new Business Rule on the Incident table.

  • Set it to run after update (after the Incident record is updated).

  • In the condition, specify when you want the notification to trigger (e.g., any update or specific field changes).

  • In the script section, query the related Incident Tasks and send an event or directly trigger notifications to the Assigned To of those tasks.

Example script snippet (conceptual):

(function executeRule(current, previous /*null when async*/) {
    var taskGR = new GlideRecord('incident_task');
    taskGR.addQuery('incident', current.sys_id);
    taskGR.query();
    while (taskGR.next()) {
        if (taskGR.assigned_to) {
            gs.eventQueue('incident.task.incident.updated', taskGR, taskGR.assigned_to.sys_id, current.sys_id);
        }
    }
})(current, previous);

 

This script queues an event for each incident task's assigned_to user when the incident is updated.

 

2. Create a Notification Triggered by the Event

  • Go to System Notification > Email > Notifications.

  • Create a new notification.

  • Set the table to Incident Task.

  • In the When to send tab, select Event is fired and specify the event name used in your Business Rule, e.g., incident.task.incident.updated.

  • Set the recipient to Assigned To (the assigned user on the incident task).

  • Compose the email message as needed, including relevant fields from the incident and task.

Additional Tips

  • If you want to avoid multiple notifications for minor updates or certain field changes, refine the Business Rule condition to check for specific fields or states.

  • Use the event-driven approach rather than sending emails directly in the Business Rule for better performance and flexibility.

  • Test the notification by updating an Incident and verifying that the assigned users of related Incident Tasks receive the notification.

Maik