---
sourceDocument: Australia Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/application-development

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Scheduled Script API - ServiceNow Fluent

# Scheduled Script API - ServiceNow Fluent {#ariaid-title1}

* Versão de lançamento: Australia
* 
* Atualizado 12 de mar. de 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 5 min. de leitura

The Scheduled Script API defines scheduled script executions \[sysauto_script\] that run at a specific time or on a recurring basis. Scheduled script executions are also referred to as scheduled jobs.
For general information about scheduled script executions, see [Scheduled jobs](https://www.servicenow.com/docs/access?context=c_ScheduledJobs&version=australia&pubname=australia-platform-administration&ft:locale=en-US).
**Conceitos relacionados**   

* [ServiceNow Fluent](https://servicenow-prod.fluidtopics.net/pP6OxbNArnr2tlBRkmrTfw "Define application metadata in source code using the ServiceNow Fluent domain-specific programming language.")

## ScheduledScript object {#ariaid-title2}

Create a scheduled script execution \[sysauto_script\] to define a server-side script that runs on a schedule.
{#fluent-scheduled-script-object__table_qyv_1pj_4fc__entry__3}{#fluent-scheduled-script-object__now-id-desc2}

| Name | Type | Description |
|-|-|-|
| $id | String or Number | Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys_id. For more information, see [ServiceNow Fluent language constructs](https://servicenow-prod.fluidtopics.net/b1y7cW0gok5uzbNJ5JcSTw "ServiceNow Fluent language constructs provide additional functionality for development in source code with ServiceNow Fluent APIs."). Format: `Now.ID['String' or Number]` |
| name | String | Required. The name of the scheduled script. |
| active | Boolean | Required. Flag that indicates whether the scheduled script is enabled. Valid values: * true: The scheduled script executes on the specified schedule. * false: The scheduled script doesn't execute. {#fluent-scheduled-script-object__ul_otz_jgl_4fc} Default: true |
| script | Script | Required. A server-side script that runs on a schedule. This property supports a function from a JavaScript module, a reference to another file in the application that contains a script, or inline JavaScript. Format: * For functions, use the name of a function, function expression, or default function exported from a JavaScript module and import it into the .now.ts file. For information about JavaScript modules, see [JavaScript modules and third-party libraries](https://servicenow-prod.fluidtopics.net/~ZpTh0ym3z3CLJbh76lA6w "Optimize your code base using JavaScript modules to group related code or add third-party libraries and reuse their code within applications.").{#fluent-scheduled-script-object__script-function} * To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://servicenow-prod.fluidtopics.net/b1y7cW0gok5uzbNJ5JcSTw "ServiceNow Fluent language constructs provide additional functionality for development in source code with ServiceNow Fluent APIs."). * To provide an inline script, use string literals or template literals for multiple lines of code: ``'Script' or `Script```. {#fluent-scheduled-script-object__ul_rtr_vyd_1gc} |
| condition | String | A JavaScript conditional statement that specifies the fields and values that must be true for the script to run. This property supports a function from a JavaScript module, a reference to another file in the application that contains a script, or inline JavaScript. The script must return a Boolean value, which executes the scheduled script when true. Aviso: Conditional scripts for scheduled report emails and Performance Analytics data collection jobs are executed in the sandbox. Therefore, function definitions are not 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. Format: * For functions, use the name of a function, function expression, or default function exported from a JavaScript module and import it into the .now.ts file. For information about JavaScript modules, see [JavaScript modules and third-party libraries](https://servicenow-prod.fluidtopics.net/~ZpTh0ym3z3CLJbh76lA6w "Optimize your code base using JavaScript modules to group related code or add third-party libraries and reuse their code within applications.").{#fluent-scheduled-script-object__d2751e475} * To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://servicenow-prod.fluidtopics.net/b1y7cW0gok5uzbNJ5JcSTw "ServiceNow Fluent language constructs provide additional functionality for development in source code with ServiceNow Fluent APIs."). * To provide an inline script, use string literals or template literals for multiple lines of code: ``'Script' or `Script```. {#fluent-scheduled-script-object__d2751e472} |
| runType | String | The time interval to use for running the scheduled script. Valid values: * daily: Runs daily 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. * once: Runs for a single occurrence only. * periodically: Runs on a designated repeating interval. * on_demand: Runs on demand when a user selects Execute Now from the scheduled script record. * business_calendar_start: Runs on the starting entry dates for the business calendar that you specify with the businessCalendar property. A scheduled script 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. * business_calendar_end: Runs for the ending date for the business calendar that you specify with the businessCalendar property. This selection runs in the same manner as `business_calendar_start`, but for the end dates of the associated business calendar entries. Nota: If you specify `business_calendar_start` or `business_calendar_end`, you can apply an offset factor to schedule the script to run before or after the time span of the selected business calendar. To learn more about creating and using business calendars and defining business calendar entries, see [Creating business calendars](https://www.servicenow.com/docs/access?context=business-calendars&version=australia&pubname=australia-platform-administration&ft:locale=en-US) and [Define business calendar entries](https://www.servicenow.com/docs/access?context=define-business-calendar-entries&version=australia&pubname=australia-platform-administration&ft:locale=en-US). {#fluent-scheduled-script-object__ul-run-sched-job} |
| runTime | Object | Required if the runType property is `daily`, `weekly`, `monthly`, `once`, or `periodically`. The time of day on a 24-hour clock and the time zone on which the scheduled job runs. The default time zone is Coordinated Universal Time (UTC). runTime: { year: Number, month: Number, day: Number, hour: Number, minute: Number, second: Number, timeZone: 'String' } Valid values for timeZone: * Canada/Atlantic * Canada/Central * Canada/Eastern * Canada/Mountain * Canada/Pacific * Europe/Amsterdam * Europe/Berlin * Europe/Brussels * Europe/Dublin * Europe/London * Europe/Madrid * Europe/Paris * Europe/Rome * Europe/Stockholm * Europe/Zurich * floating * GMT * Hongkong * US/Arizona * US/Central * US/Eastern * US/Hawaii * US/Mountain * US/Pacific {#fluent-scheduled-script-object__ul_n3c_tzf_yfc} Default: 00:00:00 |
| runDayOfWeek | String | Required if the runType property is `weekly`. The day of the week on which the scheduled script runs. Valid values: * monday * tuesday * wednesday * thursday * friday * saturday * sunday {#fluent-scheduled-script-object__ul_y1j_tyq_4fc} |
| runDayOfMonth | Number | Required if the runType property is `monthly`. The day of the month on which the scheduled script runs. Minimum value: 1 Maximum value: 31 |
| runPeriod | Object | Required if the runType property is `periodically`. The designated repeating interval on which the scheduled script runs. At least one of the properties must have a non-zero value. runPeriod: { days: Number, hours: Number, minutes: Number, seconds: Number, } |
| businessCalendar | String | Required if the runType property is `business_calendar_start` or `business_calendar_end`. The sys_id of a business calendar \[business_calendar\] that is used to determine a start date or end date for the scheduled script. |
| $meta | Object | Metadata for the application metadata. With the installMethod property, you can map the application metadata to an output directory that loads only in specific circumstances. $meta: { installMethod: 'String' } Valid values for installMethod: * demo: Outputs the application metadata to the metadata/unload.demo directory to be installed with the application when the Load demo data option is selected. * first install: Outputs the application metadata to the metadata/unload directory to be installed only the first time an application is installed on an instance. {#fluent-scheduled-script-object__ul_n3q_y3s_42c} |
| $override | Object | Fields and their values provided to configure fields that aren't included in a ServiceNow Fluent API or to override an existing field. Aviso: Type safety isn't enforced for fields configured with the $override property. $override: { field: value, ... } |
[Tabela 1. Properties]

{#fluent-scheduled-script-object__table_qyv_1pj_4fc}  
In the following example, the script runs daily at 12 p.m. if a user has the admin role.

    import { ScheduledScript } from '@servicenow/sdk/core';
    import { dailyJob } from '../server/scripts.js'
                
    ScheduledScript({
        $id: Now.ID['daily_scheduled_script'],
        name: 'daily_scheduled_script',
        active: true,
        condition: 'gs.getUser().hasAssignedRole("admin");',
        runType: 'daily',
        runTime: {
            hour: 12
        },
        script: dailyJob,     
    })


