A scheduled call to a server side JavaScript function in an app, run by the platform's timer scanner. The schedule names the app repository to run in and the function within it, optionally with arguments and a profile to run as. How often it fires is set by the timer unit and multiple, for example three DAYS, and the timer time pins it to a time of day in the organisation's timezone. The next due date is when it will next run, and the scanner picks up every schedule whose next due date has passed, so changing the unit or multiple only takes effect once the next due date is recalculated. Schedule names are unique within an admin organisation and repeating schedules with a unit of MINUTES are held to a minimum of 30 minutes.

Group: Database Entities

Implements: Serializable, Relational


Properties

PropertyReturnsDescription
funcStringName of the JavaScript function called when the schedule fires, as exported by the app in the repository.
funcArgsStringArguments passed to the scheduled function when it is called, up to 2000 characters. Null when the function takes none.
idlongUnique database identifier for this schedule.
nameStringIdentifier for the schedule, unique within the admin organisation and used to find it again. Creating a second schedule with the same name in the same organisation is rejected. Up to 200 characters.
nextDueDateDateWhen this schedule is next due to run. The scanner picks up every schedule whose next due date has passed, in date order, and recalculates it after each run, so editing the timer settings only takes effect from the next recalculation.
repositoryRepositoryThe app repository holding the code the scheduled function lives in. Schedules are normally created against an AppRepository, and the organisation which owns the schedule is taken from it.
runAsProfileProfileThe profile the scheduled function runs as, which decides what the script is allowed to see and do. Null means the function runs without a user, so anything requiring a current user will not be available to it.
scheduleTypeJsScheduleTypeWhether the schedule repeats on its interval or fires only once, as REPEAT or ONE_TIME. Schedules created by an app are REPEAT.
timerMultipleIntegerHow many timer units apart the runs are, so three with a unit of DAYS means every three days. A multiple of fewer than 30 minutes is raised to 30 when the next due date is worked out.
timerTimeStringOptional time of day to pin each run to, as text such as "02:30". When it is set the hour, minute and second of the next due date are forced to it, in the organisation's timezone. A value which cannot be parsed is logged and ignored, leaving the run at whatever time the interval produced.
timerUnitTimeUnitThe unit the interval between runs is counted in, one of MINUTES, HOURS, DAYS, WEEKS, MONTHS or ANNUAL. Read it with the timer multiple, so DAYS with a multiple of three means every three days.
websiteBranchBranchThe website branch the scheduled function runs against, which gives the script the website context it needs. Can be null for a schedule which does not need one.

Methods

getId() · setId(long id) · getName() · setName(String name) · getRunAsProfile() · setRunAsProfile(Profile runAsProfile) · getFuncArgs() · setFuncArgs(String funcArgs) · getNextDueDate() · setNextDueDate(Date nextDueDate) · getTimerUnit() · setTimerUnit(TimeUnit timerUnit) · getTimerMultiple() · setTimerMultiple(Integer timerMultiple) · getTimerTime() · setTimerTime(String timerTime) · setOrganisation(Organisation organisation) · getWebsiteBranch() · setWebsiteBranch(Branch websiteBranch) · getRepository() · setRepository(Repository repository) · getFunc() · setFunc(String func) · getScheduleType() · setScheduleType(JsScheduleType scheduleType)

getId()

Returns: long

Unique database identifier for this schedule.

setId(long id)

Returns: void

Sets the database identifier. The database assigns this when the schedule is first saved, so it is not normally set by hand.

ParameterDescription
idthe primary key to use

getName()

Returns: String

Identifier for the schedule, unique within the admin organisation and used to find it again. Creating a second schedule with the same name in the same organisation is rejected. Up to 200 characters.

setName(String name)

Returns: void

Sets the schedule's name, which must be unique within the admin organisation.

ParameterDescription
namethe new name

getRunAsProfile()

Returns: Profile

The profile the scheduled function runs as, which decides what the script is allowed to see and do. Null means the function runs without a user, so anything requiring a current user will not be available to it.

setRunAsProfile(Profile runAsProfile)

Returns: void

Sets the profile the scheduled function runs as.

ParameterDescription
runAsProfilethe profile to run as, or null to run without one

getFuncArgs()

Returns: String

Arguments passed to the scheduled function when it is called, up to 2000 characters. Null when the function takes none.

setFuncArgs(String funcArgs)

Returns: void

Sets the arguments passed to the scheduled function.

ParameterDescription
funcArgsthe arguments to pass, or null for none

getNextDueDate()

Returns: Date

When this schedule is next due to run. The scanner picks up every schedule whose next due date has passed, in date order, and recalculates it after each run, so editing the timer settings only takes effect from the next recalculation.

setNextDueDate(Date nextDueDate)

Returns: void

Sets when the schedule is next due to run.

ParameterDescription
nextDueDatethe timestamp the schedule should next run

getTimerUnit()

Returns: TimeUnit

The unit the interval between runs is counted in, one of MINUTES, HOURS, DAYS, WEEKS, MONTHS or ANNUAL. Read it with the timer multiple, so DAYS with a multiple of three means every three days.

setTimerUnit(TimeUnit timerUnit)

Returns: void

Sets the unit the interval between runs is counted in.

ParameterDescription
timerUnitthe unit of the repeat interval

getTimerMultiple()

Returns: Integer

How many timer units apart the runs are, so three with a unit of DAYS means every three days. A multiple of fewer than 30 minutes is raised to 30 when the next due date is worked out.

setTimerMultiple(Integer timerMultiple)

Returns: void

Sets how many timer units apart the runs are.

ParameterDescription
timerMultiplethe number of timer units between runs

getTimerTime()

Returns: String

Optional time of day to pin each run to, as text such as "02:30". When it is set the hour, minute and second of the next due date are forced to it, in the organisation's timezone. A value which cannot be parsed is logged and ignored, leaving the run at whatever time the interval produced.

setTimerTime(String timerTime)

Returns: void

Sets the time of day each run is pinned to.

ParameterDescription
timerTimethe time of day as text, for example "02:30", or null for no fixed time

setOrganisation(Organisation organisation)

Returns: void

Sets the admin organisation which owns this schedule.

ParameterDescription
organisationthe owning admin organisation

getWebsiteBranch()

Returns: Branch

The website branch the scheduled function runs against, which gives the script the website context it needs. Can be null for a schedule which does not need one.

setWebsiteBranch(Branch websiteBranch)

Returns: void

Sets the website branch the scheduled function runs against.

ParameterDescription
websiteBranchthe website branch to run against

getRepository()

Returns: Repository

The app repository holding the code the scheduled function lives in. Schedules are normally created against an AppRepository, and the organisation which owns the schedule is taken from it.

setRepository(Repository repository)

Returns: void

Sets the repository holding the code the scheduled function lives in.

ParameterDescription
repositorythe repository to run the function from

getFunc()

Returns: String

Name of the JavaScript function called when the schedule fires, as exported by the app in the repository.

setFunc(String func)

Returns: void

Sets the name of the JavaScript function called when the schedule fires.

ParameterDescription
functhe name of the function to call

getScheduleType()

Returns: JsScheduleType

Whether the schedule repeats on its interval or fires only once, as REPEAT or ONE_TIME. Schedules created by an app are REPEAT.

setScheduleType(JsScheduleType scheduleType)

Returns: void

Sets whether the schedule repeats or fires only once.

ParameterDescription
scheduleTypethe schedule type, REPEAT or ONE_TIME
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.