@servicenow/sdk - v4.7.0
    Preparing search index...

    Interface ScheduledScript

    interface ScheduledScript {
        $id: string | number | ExplicitKey<string>;
        $override?: Record<string, string | number | boolean>;
        active?: boolean;
        advanced?: boolean;
        businessCalendar?: string | Record<"business_calendar">;
        condition?: string;
        conditional?: boolean;
        dayOfMonth?: DayOfMonth;
        dayOfWeek?: DayOfWeek;
        daysOfWeek?: [DayOfWeek, ...DayOfWeek[]];
        executionEnd?: string;
        executionInterval?: Duration;
        executionStart?: string;
        executionTime?: TimeOfDay;
        frequency?: RunType;
        maxDrift?: Duration;
        month?: MonthOfYear;
        name?: string;
        offset?: Duration;
        offsetType?: "future" | "past";
        protectionPolicy?: "read" | "protected";
        repeatEvery?: number;
        runAs?: string | Record<"sys_user">;
        script?: string | ((...args: unknown[]) => void);
        timeZone?: string & {} | "floating";
        upgradeSafe?: boolean;
        userTimeZone?: string & {};
        weekInMonth?: WeekInMonth;
    }
    Index

    Properties

    $id: string | number | ExplicitKey<string>
    $override?: Record<string, string | number | boolean>

    Set properties not directly supported by this API.

    active?: boolean

    Indicates whether the scheduled job is active and will run

    true
    
    advanced?: boolean

    Indicates whether this job can run in advanced mode

    false
    
    businessCalendar?: string | Record<"business_calendar">

    Reference to a business calendar for calendar-based scheduling (sys_id of business_calendar) or new calendar record

    condition?: string

    Script-based condition that must evaluate to true for the job to run. Only evaluated when conditional is true.

    conditional?: boolean

    If true, the job only runs when the condition script evaluates to true. Allows conditional execution of the job.

    false
    
    dayOfMonth?: DayOfMonth

    Day of the month when the job runs (1-31)

    dayOfWeek?: DayOfWeek

    Specific day of the week when the job runs (for weekly jobs)

    daysOfWeek?: [DayOfWeek, ...DayOfWeek[]]

    Days of the week when the job runs (array of day names)

    executionEnd?: string

    Date and time when the job should stop running. Jobs with ending values in the past are marked inactive

    executionInterval?: Duration

    Interval between runs for periodic jobs

    executionStart?: string

    Date and time when the job should start running

    executionTime?: TimeOfDay

    Time of day when the job runs

    frequency?: RunType

    Frequency at which the job runs.

    maxDrift?: Duration

    Maximum time the job can drift from its scheduled time before being cancelled

    month?: MonthOfYear

    Month when the job runs (1-12, for yearly jobs)

    name?: string

    Name of the scheduled script execution job

    offset?: Duration

    Offset duration from the scheduled time

    offsetType?: "future" | "past"

    Direction of offset from the scheduled time.

    • future: Job runs after the scheduled time
    • past: Job runs before the scheduled time
    protectionPolicy?: "read" | "protected"

    Controls edit/view access for other developers after the application is installed.

    • read: Others can see the script logic but not change it.
    • protected: Others cannot change this record.
    • Omit to allow other developers to customize this record.
    repeatEvery?: number

    For recurring trigger types, repeat only every Nth occurrence (e.g., 3 means every 3rd occurrence)

    runAs?: string | Record<"sys_user">

    User whose credentials are used to execute the scheduled job (sys_id or username)

    script?: string | ((...args: unknown[]) => void)

    Script to be executed when the job runs. Accepts a module function (imported from a server module), a Now.include('./script.js') reference for file-based editing, or an inline string.

    timeZone?: string & {} | "floating"

    Time zone in which the job runs. Use 'floating' for system time zone

    'floating'
    
    upgradeSafe?: boolean

    Indicates if this scheduled job should be preserved during upgrades

    false
    
    userTimeZone?: string & {}

    Time zone context for any GlideDateTime or relative date calculations inside the script. Defaults to the time zone defined in the user profile of the user specified in the "Run as" field.

    weekInMonth?: WeekInMonth

    Week within the month when the job runs (1=First, 2=Second, 3=Third, 4=Fourth, 5=Fifth, 6=Sixth)