Record template fields
The fields of a record template and its template values, the Templates menu items, and the three patterns for setting a value.
This reference lists the fields of a record template (the System template table) and of its values (System template value), and shows the ways a value can be set. Use it while you follow Create a record template.
Template
| Field | Type | Required | Behaviour | Purpose |
|---|---|---|---|---|
| Name | String | Yes | Shown in the template list when the template is client selectable. | Identifies the template, for example “Example incident template”. |
| Table | Table | No | The table the template applies to, for example Incident. | |
| Active | Boolean | No | Defaults to Yes. | Whether the template can be used. |
| Client selectable | Boolean | No | Defaults to Yes. | Yes makes the template available on the record form. No keeps it for scheduled templates. A client-selectable template can be used both ways. |
| Order | Order | No | The position in the list when several templates share a name. | |
| Description | Text | No | What the template does. | |
| System Template Values | Related list | No | Use New to add a value. Add/remove only re-links a value that lost its template. | The values the template sets. |
Template value
| Field | Type | Required | Behaviour | Purpose |
|---|---|---|---|---|
| Template | Reference (System template) | No | A value belongs to one template only. | The template the value belongs to. |
| Field | Field of the template’s table | No | The field the value sets, for example ClientJournal. | |
| Active | Boolean | No | Defaults to Yes. | Whether the value is applied. |
| Advanced | Boolean | No | Defaults to No. When Yes, Script is used instead of Stored value. | Switches the value to a script. |
| Overwrite existing value | Boolean | No | Defaults to Yes. | Whether the value replaces one already on the record. |
| Order | Integer | No | Defaults to 10. Not used today. | Reserved for back-end processing. |
| Stored value | String | No | Accepts a ${name} parameter when run by a scheduled template. |
The fixed value: a choice key, a record ID or a string. |
| Script | Code | No | Used when Advanced is Yes. The last line is the value. | A server script that works out the value from the record. |
Ways to set a value
Fixed value
Leave Advanced off and enter the value in Stored value. For a choice field, enter the choice key, for example 1 for Priority rather than its label. Find the key on the field definition’s field-specific settings. For a reference field, enter the referenced record’s ID. For a string field, enter the text.
Parameter from a scheduled template
Leave Advanced off and enter the parameter name in braces in Stored value, for example ${Priority}. The context script of the scheduled template that runs the template supplies the value.
Script
Turn Advanced on and write server code in Script that reads the current record and ends with the value. Check that the fields you read have values. The scheduled template’s parameters are also available to the script. A typical script builds an HTML reply for a journal field that greets the requester by first name. Because journal fields are HTML, escape any angle brackets you want to show as text.
Templates menu
The Catalog & templates → Templates menu in the Administration workspace holds these items.
| Item | What it opens | Who sees it |
|---|---|---|
| New template | A new record template. | Administrators |
| All templates | Every record template. | Everyone who sees the menu |
| All client templates | Templates with Client selectable set to Yes. | Everyone who sees the menu |
| All server templates | Templates with Client selectable set to No. | Everyone who sees the menu |
| New scheduled template | A new scheduled template. | Administrators |
| All scheduled templates | Every scheduled template. | Administrators |
| New template value | A new template value. | Administrators |
| All template values | Every template value. | Administrators |
The Catalog & templates module is shown to users with application_administrator.