Docs
On this page
task2 min readApplication: Templates

Schedule a record template

Create records from one or more record templates on a schedule, with parameters passed in from a context script.

A scheduled template creates records from record templates on a timetable, for example a monthly security patching task. Set one up when the same record must be raised regularly, with values that can vary through parameters.

Before you begin

  • You need an administrator role that opens the Administration → Templates menu.
  • The record templates to run must exist. See Create a record template.
  • Decide the user the records are created as. That user needs permission to create records on the template’s table.

Steps

  1. Select Administration → Templates → New scheduled template.

  2. Enter a Name that says what the scheduled template is for, for example “Monthly patching task”. The name is not used for anything else.

  3. Set the Schedule. The schedule picker builds a cron expression, so you do not need to write one. For example, 0 0 1 1/1 * ? * runs at 1 AM on the first day of each month. Schedules run in the system time zone.

  4. In Run as, select the user the records are created as. That user appears as the creator of each record.

  5. In Templates, add the record templates to run.

  6. Write the Context script. It returns an array of parameter objects in answer. Each template runs once for every object in the array. Even with no parameters, include answer = [{}];.

    answer = [{Details: current.Name(), Priority: "3"}];
    

    Template values use the parameters as ${Details} and ${Priority}. The context script can read fields you add to the scheduled template record itself through current.

  7. Set Active to Yes and select Create.

Result

At each scheduled time, Servicely creates one record per template for every object the context script returns, with the template values applied and parameters filled in. In the example, a template whose Short description value is ${Details} and whose Priority value is ${Priority} creates a record named after the scheduled template, with priority 3. All scheduled templates are listed under Administration → Templates → All scheduled templates.

Last updated 18 October 2026commit 50111ae9bd3bChris Jones
Back to top