Lessons › Domain 4: Application Automation (20%) › Lesson 15
Events, Scheduled Jobs and Script Includes
About 16 minutes · Last checked against the CAD blueprint (January 2026): 4 December 2026
Step 1 · Learn
Running logic at the right moment and reusing it
Events
An event signals that something happened, so other logic can react to it later. Register the event in the Event Registry, then fire it from a script with gs.eventQueue('x_acme_loans.overdue', current, parm1, parm2). Notifications and script actions respond to the event. Events are processed by the event queue, so the script that fires them does not wait.
Scheduled script executions
A scheduled script execution (scheduled job) runs a script at set times. Run options include Daily, Weekly, Monthly, Periodically, Once and On Demand, with an optional condition.
- To run on the last day of every month, set Run to Monthly and Day to 31: in shorter months the job runs on the last day.
- Periodically repeats after a set interval, such as every 4 hours.
- A typical job finds overdue loans with GlideRecord and fires an event for each one.
Script includes
A script include stores reusable server-side code that other scripts call, instead of repeating it. A utility (Utils) script include groups related functions for one application.
- Class-based: created with
Class.create()and aprototypethat holds the methods, called withnew x_acme_loans.LoanUtils().method(). - Client callable: extends
AbstractAjaxProcessorso client scripts can call it with GlideAjax. - Accessible from: decides whether other scopes may call it.
Script includes only run when called, so they do not slow anything down until they are used.
Step 2 · Do
Remind users about overdue loans
Every night, find overdue loans and email the borrowers, reusing one script include. This is a practice environment of our own design, not the ServiceNow product. Complete the tasks in the task list.
Step 3 · Check
Exam-style questions
Select an answer and check it. Every answer includes an explanation.