A Scheduled Job is a script that runs automatically at a defined time or interval to perform a specific task in ServiceNow.
Scheduled Jobs are used when:
No user action is required
A task must run daily, weekly, monthly, or at a specific time
Data needs to be processed in the background
When you create a Scheduled Job, you configure:
Meaningful name describing the job
When the job should run:
Daily
Weekly
Monthly
Once
Periodically (every X minutes/hours)
The logic that will execute automatically
Scenario:
Automatically close incidents that are in Resolved state for more than 7 days.
var gr = new GlideRecord(‘incident’);
gr.addQuery(‘state’, ‘6’); // Resolved
gr.addEncodedQuery(‘sys_updated_on<=javascript:gs.daysAgoStart(7)’);
gr.query();
while (gr.next()) {
gr.state = ‘7’; // Closed
gr.update();
}
System Definition → Scheduled Jobs → New


Create an Email Notification:

Hello Team,
Below are the incidents open for more than 3 days:
${parm1}
Regards,
ServiceNow



Every morning at 7:00 AM: