ServiceNow Scheduled Jobs Configurations
Description
ServiceNow Scheduled Jobs
Let’s go through ServiceNow Scheduled Jobs configurations carefully and in detail. Scheduled Jobs in ServiceNow are automated tasks that run at defined times or intervals to perform system activities such as data imports, reports, or maintenance tasks.
1. Overview of Scheduled Jobs
In ServiceNow, scheduled jobs (sometimes called Scheduled Scripts or Scheduled Tasks) are configured to automate processes. They can:
- Execute server-side scripts.
- Run reports or exports.
- Perform maintenance tasks like cleanup or integration jobs.
The main table for scheduled jobs is:
sys_trigger – This stores scheduled job records, triggers, and their execution details.
2. Types of Scheduled Jobs
ServiceNow provides multiple ways to define a scheduled job:
- Basic Scheduled Job
- Runs a script at a specified time or interval.
- Can be created via: System Definition → Scheduled Jobs → New.
- Scheduled Script Execution
- Allows custom server-side JavaScript execution.
- Useful for automation that requires logic, like data updates or integrations.
- Report Scheduled Jobs
- Runs a report and optionally emails results.
- Useful for periodic reporting tasks.
- Event-Triggered Jobs
- Executes a job based on events rather than a time schedule.
- Less common but possible via Event Management.
3. Key Configuration Fields in Scheduled Jobs
When creating a scheduled job, you’ll encounter several configuration options:
| Field | Description |
|---|---|
| Name | Friendly name for the job. |
| Run | Defines the schedule: Once, Daily, Weekly, Monthly, or a Cron expression. |
| Time/Start | When the job first runs. |
| Repeat Interval | Time between executions for recurring jobs. |
| Active | Whether the job is enabled. |
| Script | Server-side JavaScript to execute (if using Scheduled Script). |
| Condition | Optional script condition to determine if the job should run. |
| Optional notifications after execution. | |
| Time Zone | Executes based on the specified time zone. |
4. Scheduling Options
- One-time: Runs only once at a specific date and time.
- Recurring: Can run on:
- Daily (e.g., every day at 2 AM)
- Weekly (e.g., every Monday at 6 AM)
- Monthly (e.g., 1st of every month at midnight)
- Cron expressions for advanced schedules.
5. Best Practices
- Use conditions to limit executions: Prevent unnecessary load on the system.
- Log results: Use
gs.log()or create audit records for monitoring. - Monitor executions: Use System Logs → Scheduled Jobs → Job Logs to track failures.
- Avoid overlapping jobs: Use
gs.isScheduled()or check active records to prevent conflicts. - Test scripts: Always test your scripts in a sub-production environment before scheduling in production.
6. Example
A simple Scheduled Script to close incidents older than 30 days:
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state!=7^opened_atRELATIVELE@dayofweek@-30'); // Not closed, older than 30 days
gr.query();
while(gr.next()){
gr.state = 7; // Closed
gr.update();
}
gs.log('Old incidents closed successfully.');
- This script could run daily at 2 AM.
- Logs results in system logs.
- Prevents unnecessary workload during peak hours.
If you want, I can also draw a diagram showing how Scheduled Jobs are configured and executed in ServiceNow—it’s very helpful for visualizing the process.
Do you want me to make that diagram?

Product Reviews