---
sourceDocument: Australia ServiceNow AI Platform Administration
sourceDocumentLink: https://www.servicenow.com/docs/r/platform-administration

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Run a script of your choosing

# Automatically run a script of your choosing {#ariaid-title1}

* Release version: Australia
* 
* Updated March 12, 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 7 minutes to read

Schedule both conditional and non-conditional scripts. If Domain Separation is
installed in the instance, you can also select, filter, sort, and schedule scripts based on
their assigned domains.

## Before you begin

Roles required: system_scheduler_admin

## About this task

The following is an example of a conditional script. It 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.addAggregate('COUNT');
    ga.addQuery('active', 'true');
    ga.addQuery('sys_created_on', '<', gs.daysAgo(30));
    ga.query();
    ga.next();
    ga.getAggregate('COUNT') !== '0'

## Procedure

1. Navigate to AllSystem DefinitionScheduled Jobs.
2. Select New.
3. Select Automatically run a script of your choosing.
4. On the form, fill in the fields.  
   {#t_ScheduleAScriptExecution__t_ScheduleScriptExecution__entry__2}{#t_ScheduleAScriptExecution__starting-sched-job}

   | Field | Description |
   |-|-|
   | Name | Name that identifies this scheduled job. |
   | Active | Option that indicates that scheduled job is active and should be executed at the specified date and time. |
   | Application | Name of the application that contains the script. Global appears if the script is in the global scope. |
   | Conditional | Option for enabling the running of the scheduled job if certain conditions are met in the associated script. |
   | Condition | A conditional script that determines if a scheduled job should run. The last expression of the script should evaluate to a Boolean (true/false) value. This text box appears only if you select Use conditions. Warning: Conditional scripts for scheduled report emails and Performance Analytics data collection jobs are executed in the sandbox. Therefore, function definitions aren't allowed. Some API calls and keywords are also not allowed. For more information, see [Script sandbox evaluator](https://www.servicenow.com/docs/access?context=script-sandbox&version=australia&pubname=australia-api-reference&ft:locale=en-US). After upgrade, jobs with conditional scripts that contain these disallowed API components finish with errors. |
   | Run | Time interval to use for running the scheduled job: * Daily: Runs daily, at a designated time. * Day and Month in Year: Runs yearly on a specific day and month (for example, July 14), at a designated time. * Day in Week in Month in Year: Runs yearly on a specific day of the week in a specific week of a specific month (for example, the second Monday in October), at a designated time. * Week in Month: Runs monthly during a specific week of the month (for example, the third week of each month), on designated days and at a designated time. * Weekly: Runs on a weekly basis, at a designated time and day of the week. * Monthly: Runs on a monthly basis, at a designated time and day of the month. * Periodically: Runs on a designated repeating interval. * Once: Runs for a single occurrence only. * On Demand: Runs immediately on demand. * Business Calendar: Entry Start: Runs on the starting entry dates for the business calendar that you select in the Business Calendar field. A scheduled job runs for the starting date of each of the business entries that you defined for the business calendar. For example, if the business calendar represents a fiscal year, and the starting date of each entry is a fiscal month, the scheduled job runs on the first day of each month. {#t_ScheduleAScriptExecution__p_nyg_nfg_h1c} * Business Calendar: Entry End: Runs for the ending date for the business calendar that you select in the Business Calendar field. This selection runs in the same manner as Business Calendar: Entry Start, but for the end dates of the associated business calendar entries. Note: When you select Business Calendar: Entry Start or Business Calendar: Entry End, you can apply an offset factor to schedule the job to run before or after the time span of the selected business calendar. If you select a business calendar and all its business calendar spans are in the past, the job would never run since that is an invalid configuration. To learn more, see the Offset type and Offset fields. To learn more about creating and using business calendars and defining business calendar entries, see [Creating business calendars](https://www.servicenow.com/docs/Li7sNC_vdQ82QrLlTM0Nzw "Create business calendars in the ServiceNow AI Platform so that you can schedule events for your users and track their time across applications. You define schedules and calendars of all types, including fiscal calendars, in the Business Calendar menu.") and [Define business calendar entries](https://www.servicenow.com/docs/RsqtGhINExsuf83dciffSw#define-business-calendar-entries "Create business calendar entry records that define the individual time periods that make up a business calendar. You create a business calendar entry for every individual time span in the calendar."). {#t_ScheduleAScriptExecution__ul-run-sched-job} |
   | Day | Day on which the scheduled job should run. * If Run is set to Weekly, select the day of the week. For example, select Wednesday. * If Run is set to Monthly, select the day of the month. For example, select 25 for the 25th day of the month. {#t_ScheduleAScriptExecution__ul-day-sched-job}This field appears only if you select Monthly or Weekly in the Run field. |
   | Repeat Interval | Duration of the repeat interval for each scheduled job execution. Enter the duration in the number of days, hours, or minutes. For example: * To run the scheduled job every four days, enter <kbd class="ph userinput">04</kbd> in the Days field. * To run it every 26 hours, enter <kbd class="ph userinput">26</kbd> in the Hours field. * If it should repeat at an interval of 13:30:25, enter <kbd class="ph userinput">13</kbd> in the Hours field, and then enter <kbd class="ph userinput">30</kbd> and <kbd class="ph userinput">25</kbd> in the two unlabeled fields after it. {#t_ScheduleAScriptExecution__ul_bmk_m2b_njb} |
   | Time zone | Time zone to use with the Time field entry when you specify the time at which the scheduled job should run. Select a time zone entry: * -None-: Use the default time zone for the logged-in user who is creating the scheduled job. For example, the scheduled job runs at 04:45 p.m. US/Pacific time if it's the user's assigned time zone, and you enter <kbd class="ph userinput">16:45</kbd> into the Time field. {#t_ScheduleAScriptExecution__p_qyg_nfg_h1c} * Use System Time Zone: Use the default system time zone that is specified for the instance in which it runs. For example, the scheduled job runs at 10:15 p.m. London time if Europe/London is the default system time zone for the instance, and you enter <kbd class="ph userinput">22:15</kbd> in the Time field. {#t_ScheduleAScriptExecution__p_ryg_nfg_h1c} * Actual time zone. For example, the scheduled job runs at 1:30 p.m. in the US Eastern time zone if you select US/Eastern, and enter <kbd class="ph userinput">13:30</kbd> in the Time field. {#t_ScheduleAScriptExecution__p_syg_nfg_h1c} {#t_ScheduleAScriptExecution__ul_zxv_cnb_njb} |
   | Time | Time of day at which the scheduled job should run, expressed in hours, minutes, and seconds on a 24-hour clock. The selection that you make in the Time zone field determines the time zone for this entry. |
   | Day | Day on which the scheduled job should run. * If Run is set to Weekly, select the day of the week. For example, select Wednesday. * If Run is set to Monthly, select the day of the month. For example, select 25 for the 25th day of the month. {#t_ScheduleAScriptExecution__d2181e243}This field appears only if you select Monthly or Weekly in the Run field. |
   | Repeat Interval | Duration of the repeat interval for each scheduled job execution. Enter the duration in the number of days, hours, or minutes. For example: * To run the scheduled job every four days, enter <kbd class="ph userinput">04</kbd> in the Days field. * To run it every 26 hours, enter <kbd class="ph userinput">26</kbd> in the Hours field. * If it should repeat at an interval of 13:30:25, enter <kbd class="ph userinput">13</kbd> in the Hours field, and then enter <kbd class="ph userinput">30</kbd> and <kbd class="ph userinput">25</kbd> in the two unlabeled fields after it. {#t_ScheduleAScriptExecution__d2181e284} |
   | Starting | Allows you to define the beginning window of time when you would like your job to start running. The job will actually run at the time specified in Run time. Select the calendar date and time. The Starting field appears only if you select one of the following Run types in the Run field: * Daily * Day and Month in Year * Day in Week in Month in Year * Monthly * Once * Periodically * Week in Month * Weekly {#t_ScheduleAScriptExecution__ul_ay1_xjr_mfc} For the run type Periodically, the Starting time is the date and time of the first scheduled job generation. |
   | Business Calendar | Business calendar entry that you're using to determine the business calendar start or end date for the scheduled job. This field appears only if you select Business Entry: Start Date or Business Entry: End Date in the Time field. |
   | 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 | Name of the script to run at the scheduled date and time. For example, copy script logic from a business rule, or call a script include. |
   [Table 1. Schedule script execution]

   {#t_ScheduleAScriptExecution__t_ScheduleScriptExecution}
5. If Domain Separation is installed in this instance, the following fields also appear for selecting, sorting, and scheduling jobs by domain.  
   Note:  
   The Domain Support - Domain Extensions Installer plugin installs these fields. To learn more, see [Request domain separation](https://www.servicenow.com/docs/access?context=t_ActivateDomainSeparation&version=australia&pubname=australia-platform-security&ft:locale=en-US).
   {#t_ScheduleAScriptExecution__table_m2n_yyf_tlb__entry__2}

   | Field | Description |
   |-|-|
   | Domain iterator | Check box that enables this job to run across multiple domains. If selected, the Domain source table and Domain source filter fields appear. |
   | Domain source table | Name of the domain-separated table that is the source of the domains in which the scheduled job should run. For example, select Department (cmn_department) if you want to use it as the source of the assigned domains used to schedule scripts. The scheduled job determines these domains from the sys_domain field of the source table records. To learn more, see [Domain assignment](https://www.servicenow.com/docs/access?context=c_DomainAssignment&version=australia&pubname=australia-platform-security&ft:locale=en-US). Note: It's a good idea to create a domain-separated table solely dedicated to sourcing domains, unless you have a use case that warrants using an existing one. If you do create a new one, simply select it using this field. |
   | Domain source filter | Optional condition you can specify to filter the records queried from the selected domain source table. 1. Select the field to use for filtering records. 2. Add filtering conditions and operators to narrow the domain selection criteria. To learn more, see [Filters](https://www.servicenow.com/docs/access?context=c_Filters&version=australia&pubname=australia-platform-user-interface&ft:locale=en-US). {#t_ScheduleAScriptExecution__ol_tbc_fck_vlb} |
   [ ]

   {#t_ScheduleAScriptExecution__table_m2n_yyf_tlb}  
   The following processing takes place when scheduling a job in a domain-separated instance:
   * It first queries the selected domain source table.
   * If you specified a condition in the Domain source filter field, it applies the filtering condition to narrow down the resulting set of records.
   * Finally, it retrieves its list of unique domains from the sys_domain columns of these records.
   {#t_ScheduleAScriptExecution__ul_wnp_kff_vlb}
6. Select Update to update the scheduled job, Execute Now to execute the scheduled script immediately, or Delete to delete the job.
**Related concepts**   

* [Advanced options for scheduled jobs](https://www.servicenow.com/docs/tz60Gpmh6m5C3SfqFRe14A "Advanced scheduling options for scheduled jobs support greater flexibility in job planning and execution. You can configure jobs to start on a future date, end on a particular date, and define how the job should repeat.")  
**Related tasks**   

* [Create a scheduled job](https://www.servicenow.com/docs/PWUqMa2pdX9M0u89y_hQqg "Create a scheduled job on the Schedule Job [sysauto] table.")
* [Enable run types for scheduled job child tables](https://www.servicenow.com/docs/Jzf2415mP51TaiUJceUn~w#customize-run-times-for-scheduled-jobs "The run types; Day and Month in Year, Day in Week in Month in Year, and Week in Month, require the fields; Day, Month, and Year to be visible. Child tables which don’t display those fields can't create jobs with that run type selected.")
* [Personalize the system date format](https://www.servicenow.com/docs/h6FdLBdKp54m5lei1ppIQg "You can personalize the format in which date values appear in your instance.")
* [Set a system time zone](https://www.servicenow.com/docs/e3Vt9r9Qg2iDgvAZaHse6g "Set your system time zone with a system property.")  
**Related topics**   

* [Domain separation for service providers](https://www.servicenow.com/docs/access?context=domain-sep-landing-page&version=australia&pubname=australia-platform-security&ft:locale=en-US)

*[\>]: and then


