hi

umar5
Tera Contributor

.............................................

2 REPLIES 2

Chavan AP
Kilo Sage
If i understand it correctly below is the  Requirements Summary

Modules: ITSM-Incident, MIM, Problem, Change/Release
Trigger: Incidents not updated within 3 business days
Recipients: Assignee + Manager (or Assignment Group Manager if unassigned)
Escalation: After 3 reminders, notify xyz@gmail.com
Purpose: Prevent incidents from aging without proper attention



Implementation Steps
Step 1: Create Tracking Field
Add a field to track reminder counts on the Incident table.
Navigate to System Definition > Tables
Open the Incident [incident] table
In the Columns section, click New
Configure the new field:
Type: Integer
Column label: Reminder Count
Column name: u_reminder_count
Default value: 0
Save the column



Step 2: Configure Scheduled Job
Create a daily job to identify and process inactive incidents.
Navigate to System Definition > Scheduled Jobs
Click New and select "Automatically run a script of your choosing"
Configure the job:
Name: Automated Incident Reminder System
Run: Daily (recommend off-peak hours)
Active: True
Add the following script:
// Automated Incident Reminder System
// Processes incidents inactive for 3+ business days

(function() {
    // Configuration
    var SCHEDULE_NAME = '8-5 weekdays'; // Update with your business schedule
    var BUSINESS_DAYS_THRESHOLD = 3;
    var MAX_REMINDERS = 3;
    var ESCALATION_EMAIL = 'xyz@gmail.com';
    
    // Query active incidents with reminder count less than max
    var incident = new GlideRecord('incident');
    incident.addQuery('active', true);
    incident.addQuery('u_reminder_count', '<', MAX_REMINDERS);
    incident.query();
    
    gs.info('Processing ' + incident.getRowCount() + ' incidents for reminder checks');
    
    while (incident.next()) {
        if (shouldSendReminder(incident, SCHEDULE_NAME, BUSINESS_DAYS_THRESHOLD)) {
            processIncidentReminder(incident, MAX_REMINDERS);
        }
    }
    
    function shouldSendReminder(inc, scheduleName, threshold) {
        var now = new GlideDateTime();
        var lastUpdated = new GlideDateTime(inc.sys_updated_on);
        
        // Calculate business days since last update
        var schedule = new GlideSchedule();
        if (!schedule.load(scheduleName)) {
            gs.error('Failed to load schedule: ' + scheduleName);
            return false;
        }
        
        var duration = schedule.duration(lastUpdated, now);
        var businessHoursThreshold = threshold * 8 * 3600 * 1000; // Convert days to milliseconds
        
        return duration.getNumericValue() > businessHoursThreshold;
    }
    
    function processIncidentReminder(inc, maxReminders) {
        // Increment reminder count
        var newCount = parseInt(inc.u_reminder_count) + 1;
        inc.u_reminder_count = newCount;
        
        // Determine event type
        var eventName = (newCount >= maxReminders) ? 
            'incident.reminder.escalation' : 
            'incident.reminder.standard';
        
        // Fire appropriate event
        gs.eventQueue(eventName, inc, gs.getUserID(), gs.getUserName());
        
        // Update the record
        inc.update();
        
        gs.info('Sent reminder #' + newCount + ' for incident ' + inc.number + ' (Event: ' + eventName + ')');
    }
})();



Step 3: Register Custom Events
Create event registry entries for the notification triggers.
Navigate to System Policy > Events > Registry

Create First Event:
Event name: incident.reminder.standard
Table: Incident [incident]
Fired by: Automated Incident Reminder System

Create Second Event:
Event name: incident.reminder.escalation
Table: Incident [incident]
Fired by: Automated Incident Reminder System


Step 4: Configure Email Notifications
Standard Reminder Notification
Navigate to System Notification > Email > Notifications


Click New and configure:


Name: Incident Reminder - Standard
Table: Incident [incident]
Active: True
When to send tab:


Send when: Event is fired
Event name: incident.reminder.standard

Who will receive tab:


Switch to Advanced view
In Users/groups in fields script:
// Determine recipients based on assignment status
if (current.assigned_to.isNil()) {
    // Incident is unassigned - notify Assignment Group Manager
    if (!current.assignment_group.manager.isNil()) {
        answer.push(current.assignment_group.manager.sys_id);
    }
} else {
    // Incident is assigned - notify Assignee and their Manager
    answer.push(current.assigned_to.sys_id);
    
    if (!current.assigned_to.manager.isNil()) {
        answer.push(current.assigned_to.manager.sys_id);
    }
}





What it will contain tab:
Subject: Action Required: Incident ${number} - 3 Business Days Without Update
Message HTML:
<p>Hello,</p>

<p>This is an automated reminder regarding <strong><a href="${URI_REF}">${number}</a></strong> which requires your attention.</p>

<p><strong>Issue:</strong> This incident has not been updated in the last 3 business days.</p>

<p><strong>Required Action:</strong></p>
<ul>
    <li>Add work notes documenting current status and next steps, OR</li>
    <li>Provide resolution notes and resolve the incident if work is complete</li>
</ul>

<p><strong>Incident Details:</strong></p>
<ul>
    <li><strong>Number:</strong> ${number}</li>
    <li><strong>Short Description:</strong> ${short_description}</li>
    <li><strong>Priority:</strong> ${priority}</li>
    <li><strong>Last Updated:</strong> ${sys_updated_on}</li>
</ul>

<p>Please take action within the next business day to prevent escalation.</p>

<p>Thank you,<br/>
ServiceNow Automation</p>





Escalation Notification
Create another New notification:


Name: Incident Reminder - Escalation
Table: Incident [incident]
Active: True
When to send tab:


Send when: Event is fired
Event name: incident.reminder.escalation
Who will receive tab:


Email addresses: xyz@gmail.com
What it will contain tab:


Subject: Escalation Required: Incident ${number} - 3 Reminders Sent
Message HTML:
<p>Team,</p>

<p>This is an automated escalation notification for <strong><a href="${URI_REF}">${number}</a></strong>.</p>

<p><strong>Escalation Reason:</strong> This incident has received 3 automated reminders without resolution or meaningful updates.</p>

<p><strong>Incident Details:</strong></p>
<ul>
    <li><strong>Number:</strong> ${number}</li>
    <li><strong>Short Description:</strong> ${short_description}</li>
    <li><strong>Priority:</strong> ${priority}</li>
    <li><strong>Assigned to:</strong> ${assigned_to.name} (${assigned_to.email})</li>
    <li><strong>Assignment Group:</strong> ${assignment_group.name}</li>
    <li><strong>Last Updated:</strong> ${sys_updated_on}</li>
    <li><strong>Reminder Count:</strong> ${u_reminder_count}</li>
</ul>

<p><strong>Recommended Actions:</strong></p>
<ul>
    <li>Contact the assignee directly to understand current status</li>
    <li>Review incident priority and assignment</li>
    <li>Consider reassignment if necessary</li>
</ul>

<p>Please investigate and take appropriate action.</p>

<p>ServiceNow Automation System</p>


Configuration Notes
Business Schedule
Update the SCHEDULE_NAME variable in the scheduled job script to match your organization's business hours schedule. Find your schedule name under System Scheduler > Schedules.


Customization Options
Frequency: Modify the scheduled job frequency if different reminder intervals are needed
Modules: Extend to other tables (Problem, Change) by creating similar configurations
Escalation Email: Update xyz@gmail.com to your team's distribution list
Reminder Count: Adjust MAX_REMINDERS constant to change escalation threshold



 

Glad I could help! If this solved your issue, please mark it as Helpful and Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

Rafael Batistot
Kilo Patron

Hi @umar5 

 

For this situation you’ll need combine: 

  • Event Register(to send email) 
  • Notification (body email)
  • Schedule job ( to verify these incidents) 

 

This steps might help you 

 

Step 1: Scheduled Job (Scheduler to Check Stale Incidents)

  • Create a Scheduled Script Execution that runs daily on business days.
  • Script logic:
    1. Query all open incidents where:
      • state != Resolved/Closed
      • sys_updated_on is older than 3 business days (use gs.daysAgoStart(3) or a business calendar if you want true business days).
    2. For each Incident:
      • Check if it has already had 3 reminders sent (you’ll need a custom field or sys_trigger tracking table to count reminders).
      • If less than 3 → fire a custom event (incident.reminder.due) and increment reminder counter.
      • If 3 reminders already sent → fire another event (incident.reminder.escalation) to notify escalation recipient (xyz@gmail.com)


Step 2: Event Registry

  • Create two new events:
    • incident.reminder.due
      • Params: incident.sys_id, assignee, assignment_group.manager
    • incident.reminder.escalation
      • Params: incident.sys_id, xyz@gmail.com

 

 

Step 3: Notifications

  1. Notification: “Incident Reminder to Assignee”
    • Trigger on event: incident.reminder.due
    • Recipients: Assigned to or if empty → Assignment group.Manager
    • CC: Manager of assignee (you can get via assigned_to.manager)
    • Message body:
      • Reference the incident number (INCxxxx)
      • Include last updated date
      • Encourage user to add work notes or resolve.
  2. Notification: “Escalation Reminder”
    • Trigger on event: incident.reminder.escalation
    • Recipient: xyz@gmail.com
    • Message: “Incident INCxxxx has exceeded 3 reminders without resolution.”

 


Step 4: Tracking Reminders

 

You’ll need to avoid infinite emails.

  • Add a custom integer field on Incident: reminder_count.
    • Increment each time an event is fired.
    • Reset when Incident is resolved