Troubleshooting Scheduled Jobs for Notifications in ServiceNow
- ericpark68
- Mar 21
- 2 min read
Updated: Mar 30

Scheduled jobs are powerful tools within ServiceNow that automate routine tasks, such as sending notifications based on specific conditions. However, creating a scheduled job to trigger notifications can sometimes lead to unexpected issues. In this article, we'll explain a common scenario where users encounter issues with scheduled jobs failing to send notifications and provide step-by-step guidance on resolving these problems effectively.
Understanding the Common Issue
A frequent issue faced by ServiceNow users involves a scheduled job intended to send notifications when incidents remain active beyond a certain timeframe (e.g., five days). A typical error is creating a scheduled job that doesn't correctly trigger the intended notifications, even though the event and notification setup appears correct.
Common causes for this issue include:
Incorrect queries in GlideRecord scripts.
Improper configuration of the event registry.
Missing conditions in the notification setup.
Step-by-Step Troubleshooting and Solution
To troubleshoot this effectively, follow these step-by-step instructions:
1. Verify Query Using Background Scripts:
Before applying your script to the scheduled job, run it in System Definition > Scripts – Background to ensure it retrieves the correct records:
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.addQuery('sys_created_on', '<', gs.daysAgo(5));
gr.query();
gs.info('Query found ' + gr.getRowCount() + ' records');
while (gr.next()) {
gs.info(gr.number);
}
If records appear, your query is correct.
2. Correct Use of GlideRecord Looping:
Ensure the GlideRecord is properly iterating through the records. Here's the correct way:
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.addQuery('sys_created_on', '<', gs.daysAgo(5));
gr.query();
while (gr.next()) {
gs.eventQueue('Incident.active', gr);
}
Avoid calling gr.query() within the while loop, as this will reset the query repeatedly.
3. Set up Notification:
Navigate to System Notification > Notifications.
Create a new notification triggered by your event (Incident.active).
Set recipients (e.g., Caller).
Add necessary email details and content.
Optional Alternative Solution:
If scripting seems complex, you could utilize the Condition Builder within Scheduled Jobs or Flow Designer for a simpler configuration:
Navigate to System Definition > Scheduled Jobs.
Configure conditions visually without scripts.
Alternative Approach: Using Flow Designer
If scripting proves complex, consider using Flow Designer to create a visual flow:
Open Flow Designer and create a new Flow triggered daily.
Add an action to look up incidents that match your conditions.
Add another action to send notifications to the incident callers based on the condition.
Conclusion
Creating scheduled jobs in ServiceNow requires careful scripting and event management. Always verify your queries through background scripts and avoid common pitfalls such as looping mistakes or misconfigured event registrations. By following these detailed troubleshooting steps and best practices, you'll be able to create efficient, accurate scheduled notifications, ensuring your incident management remains timely and effective.
Next Steps:
Test your scripts thoroughly in the background script area.
Consider adopting Flow Designer for simplified, robust solutions.
Regularly audit scheduled jobs to ensure ongoing accuracy and efficiency.