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 the administrator role.
  • 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. In the Administration workspace, select Catalog & templates → Templates → New scheduled template.

    The New scheduled template item in the Catalog & templates menu.
  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.

    The Create Scheduled Template form with Name, Schedule, Active, Run as, Templates and Context script.
  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. The field is required. 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. Leave Active set 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 Catalog & templates → Templates → All scheduled templates.

Last updated 3 December 2026commit 6777698daac5Chris Jones
Back to top