Docs
On this page
task1 min readApplication: Platform

Create a scheduled job

Create a job that runs a server-side script on a cron schedule, such as a daily reminder on incidents that have not been updated.

Create a scheduled job when a server-side script must run on a timetable, such as every night. Administrators use jobs for housekeeping and reminders that no user action triggers.

Before you begin

  • You need the administrator role.
  • Write and test the script first, for example in Administration → Administrator tools → Server script.
  • Decide how often the job runs. Avoid every minute, so the job does not add needless load.
  • If the job must reach other instances, create it while a change set is active.

Steps

  1. Go to Administration → Configuration → Jobs and select New.

  2. In Job name, enter a name that says what the job does. A prefix such as (CUSTOM) keeps your jobs apart from shipped ones.

  3. In Cron expression, enter the schedule, such as 0 0 1 ? * * * for 01:00 every day. Select the asterisk (*) icon next to the field to build the expression in a dialog instead.

  4. In Description, say what the job does and why.

  5. In Script, enter the server-side script. The example below adds a reminder to open incidents that nobody has updated for 14 days.

  6. Select Active and save.

let numberOfDaysCutoff = 14; // could be read from an application property instead
let cutOffDateTime = DateTime().minusDays(numberOfDaysCutoff).toStartOfDay();

Table("Incident")
    .AND(
        LTE("UpdatedOn", cutOffDateTime),
        EQUAL("Closed", false),
        NOT(EQUAL("WorkflowStatus", "resolved"))
    )
    .forEach(function (_incRec) {
        _incRec.WorkJournal("This " + _incRec.getTableName() + " is open but has not been updated for "
            + numberOfDaysCutoff.toString() + " days. Please review to see if it can be progressed or resolved.");
        // Uncomment the next line to save the journal entry on the incident
        // _incRec.update();
    });

Result

The job runs at each time the cron expression gives, in the instance time zone. To stop it, clear Active. Only active jobs are scheduled, so a job you save inactive never runs.

Last updated 18 October 2026commit f37120b6b82bChris Jones
Back to top