Types of scheduled work
ServiceNow has several types of scheduled execution:
- Scheduled Script Execution — runs a server-side script on a schedule. Most commonly used.
- Scheduled Import Set — runs a data import on schedule
- Scheduled Report — generates and emails a report
- Scheduled Flow — triggers a Flow Designer flow on a schedule
Creating a Scheduled Job
Navigate to System Definition > Scheduled Jobs. Key fields:
- Run — Daily, Weekly, Monthly, Periodically, Once
- Time — UTC time for the job to run
- Script — the server-side JavaScript to execute
- Run as — which user context to run in (defaults to admin — be specific)
Basic scheduled job script
// Close stale incidents older than 30 days with no activity
var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^state=2^sys_updated_onsetWorkflow(false) and autoSysFields(false)
In scheduled jobs, always use gr.setWorkflow(false) unless you explicitly need Business Rules to fire. This prevents email notifications, cascading Business Rules, and performance overhead from each update in a batch job.
Monitoring execution
View execution history at System Scheduler > Scheduled Job Log. Each execution shows start time, end time, status, and any errors logged during the run.
Performance considerations
Scheduled jobs on large tables run during business hours impact performance for everyone. Schedule heavy jobs for off-peak hours (UTC 2:00–5:00 AM is usually safest). Add setLimit() even on scheduled jobs to prevent runaway queries.