Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Schedule a script execution

Log in to subscribe to topics and get notified when content changes.

Schedule a script execution

Non-conditional and conditional scripts can be scheduled.


  1. Navigate to System Definition > Scheduled Jobs.
  2. Click New.
  3. Select Automatically run a script of your choosing.
  4. Populate the following fields:
    Table 1. Schedule script execution
    Field Input Value
    Name A name to identify this scheduled script execution
    Active If true, the script will be executed at the scheduled date and time.
    Run The type of schedule to execute the script on. Choices are:
    • Daily
    • Weekly
    • Monthly
    • Periodically
    • Once
    • If Run is Weekly, the day of the week
    • If Run is Monthly, the day of the month.
    Repeat Interval If Run is Periodically, the duration between each script execution.
    Note: This setting does not account for Daylight Savings Time changes. For example, if you select a period of one day, this adds 24 hours to the starting time of the job. If the start time was configured during a period with Daylight Savings Time, the job executes with a one hour offset on days when that time zone is not in Daylight Savings Time.
    Time If Run is Daily, Weekly, or Monthly, the time of day, based on a 24 hour clock.
    Starting The date and time of the first scheduled script execution.
    Application The application that contains the script.)
    Conditional If checked, the entity will only be executed if certain conditions are met.
    Condition If Conditional is checked, a script determines under what conditions the scheduled script is executed. The last expression of the script should evaluate to a Boolean (true/false) value.
    Run as [Optional] Select another user to run the script execution as. Configure the form to add this field if it is not present.
    Run this script The script to run at the scheduled date and time. For example, copy script logic from a business rule or call a script include.

Example: Example

The following is an example of a conditional script. This example runs the scheduled job only if there are active Incidents older than 30 days.

// Only run this Scheduled Job if there are active Incidents over 30 days old
var ga = new GlideAggregate('incident');
ga.addQuery('active', 'true');
ga.addQuery('sys_created_on', '<', gs.daysAgo(30));
ga.getAggregate('COUNT') !== '0'