Skip to content

Schedules

Michelle Staley edited this page Jan 18, 2023 · 3 revisions

SmartApps may schedule future executions using the Scheduling API.

Two types of scheduled executions are supported:

  • Once schedules are created to be executed exactly once at the specified day and time.
  • Cron schedules are created according to a Cron expression. These expressions may define recurring schedules (e.g., execute every fifteen minutes).

Functions

Note: The list of functions can be found here.

  • list - Returns a list of schedules for an installed app. Requires installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed.

  • get - Get a specific schedule. Requires the alphanumeric name of the schedule. Requires installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed.

  • create - Create a schedule. Requires the data for the schedule definition and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed.

  • delete - Delete on or more schedules. Requires the name of the schedule to be deleted. If not specified then all schedules of the installed app are deleted and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed.

  • schedule - Create a schedule using a cron expression. Requires the name of the schedule, the cron expression, and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed. Optionally you can specify the time zone. If not specified and the client is configured with a locationId ofa location that has geo-coordinates set, then the time zone of those coordinates is used. If that's not the case the time zone defaults to UTC. Note that in order for the coordinates lookup to work, the API token must include the r:locations:* scope.

  • runDaily - Creat a schedule that runs at a specific time once per day. Requires the name for the schedule; a SmartApp date configuration setting, an ISO date string of the format '2020-02-08T16:35:00.000-0800', a 24 hour hh:mm time expression (i.e. 16:35), or a Date object configuration setting; and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed. Optionally you can specify the time zone; If not specified and the client is configured with a locationId that has a geo-coordinates set, then the time zone of those coordinates is used.

  • runOnce - Creates a one-time schedule that runs after the specified period of time. Requires the name of the schedule; the amount of time that should elapse before the schedule runs (in seconds); an overwrite flag (so if an updated call comes in it overwrites an already scheduled runOnce if the name matches); and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed.

Deprecated Functions

  • unschedule - Deletes the schedule with the specified name. Requires the name of the schedule; and the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed. Use delete instead.

  • unscheduleAll - Deletes all schedules for the installed app. Requires the installedAppId UUID of the installed app. If the client is configured with an installed app ID then this parameter is not needed. Use delete instead.

Clone this wiki locally