Templates made of components
A template pins components and callable workflows at a release and asks for parameters. New from template makes linked workflows from one form, and a new template or component release reaches them as Update available, tested first.
On this page
A template is a workflow you make again for each customer, site or sender, kept as one definition. Its steps use components and callable workflows at a pinned release, and it declares parameters: the values that change from one copy to the next, such as a customer name, a facility code or a table. New from template asks for them in one form and makes a workflow that stays linked to the template. A new release of the template, or of a component it uses, then shows on that workflow as Update available. Each update is tested first and lands as a new draft.
Where to find it
| What | Where |
|---|---|
| Make a template | Open a workflow, then Templates › Save as template in the designer's header. |
| Your templates | Workflows › Templates: cards by Your team, in the same grid as the built-ins. |
| A template's page | Click its name: Built from, Parameters, Releases, Workflows made from it. |
| Make a workflow from it | New from template on its page (its gallery card opens the page). |
| Edit its steps | Edit steps on its page opens the designer, marked Template, with Back to template and no Run now or Deploy. |
Parameters
Parameters are declared with the same form as a callable workflow's inputs: a name, a type (text, number, whole number, yes / no, record, list), whether it is required, and a description that shows as the hint in New from template.
A step or the trigger says where a value goes with {{params.name}}:
| Where the placeholder is | What it becomes |
|---|---|
A whole field, such as a table name set to {{params.table}} | The value with its type: a number stays a number, a list stays a list. |
Inside text, such as Feed for {{params.customer}} | The value written as text. |
| Inside JavaScript (a JavaScript step's code, a condition's expression, a filter script, a script) | The value as a quoted literal where an expression goes, so const who = {{params.customer}}; is always safe. A placeholder inside a string, a template literal (`Hi {{params.x}}`) or a comment there is refused at release. |
| Left out (an optional parameter with no value) | Empty text, or null in JavaScript. |
Values are filled in when the workflow is made, so the workflow holds plain values and runs like any other. {{sender.key}} and other run-time values are a different form and stay as they are.
Parameters are configuration: keep secrets in adapter profiles, and pick a profile for each destination in New from template.
Releases
A template is used at a release, like a component. Publish release… labels the draft, for example 1.1.0, higher than every earlier release. New from template always uses the newest release. If a newer release is published while someone fills in the form, the create is refused (409) and they open the form again.
A release is refused when:
- a step uses
{{params.x}}for a parameter that isn't declared; - JavaScript has
{{params.x}}inside a string, a template literal or a comment, where a value could run as code; - a step holds a secret typed into it (header values, credentials in URLs, secrets in JavaScript);
- a Component step pins no release;
- nothing changed since the newest release (409).
Workflows made from a template
A workflow made with New from template records the template, the release it took and its own parameter values. It starts as a disabled draft, and goes live through the usual Deploy checklist. The template's page lists each one with its values, the release it took, and its status:
| Status | Means |
|---|---|
| Up to date | It has the newest template release and the newest release of each component and callable workflow it pins. |
| Update available | The template has a newer release, or a component or callable workflow it pins does. The row says which, for example Set the site 1.0.0 → 1.1.0. |
Updates
Update (one workflow) and Update all (N) apply every update a workflow has, through the same update engine as release impact and updates and linked templates:
- A newer template release: the release's steps are filled in with that workflow's own parameter values and written over its steps. Its own destination profiles, name, trigger, senders and test cases stay. A Component or Call step it already moved to a newer release keeps that release: a template update never moves a workflow back.
- Then each newer component or callable workflow release: its pins move to the newest release.
Before anything is written, the workflow's saved test cases run against its new definition. A workflow that fails a test or validation, needs a profile for a new destination, would take a major release that nobody acknowledged, or was saved meanwhile is held back unchanged, with the reason on its row. Each workflow that passes gets a new draft version. Nothing is deployed: it keeps running its deployed version until you deploy the draft.
A template is also listed under Used by of each component it uses, so the component's impact shows it too. The template keeps its pin until you edit its steps and publish a template release.
Built-in templates made of components
Some built-in templates are made of components. HL7v2 SIU appointments to BigQuery (2.0.0) is built from the component SIU appointment row (1.0.0) and asks for one parameter, table (default appointments). The first time it is used in a workspace, its component is installed there once, under Components, and every appointments feed made from it uses that copy. A later engine that ships a newer release of the component adds it as a new release, but only while the workspace has never changed its copy. Once you edit its steps or publish a release of your own, your copy stays as it is. Feeds keep their pin until they take the update.
Workflows made from the template before it was made of components keep running unchanged. They show Update available (to 2.0.0): the update replaces their three conversion steps with the component step, after their tests pass. The component sends exactly the same row.
API
| Method and path | What it does |
|---|---|
GET /api/templates | The workspace's templates. |
POST /api/templates | Save a workflow as a template: { name, fromWorkflowId }. |
GET /api/templates/:id | Steps, parameters, what it uses, releases and the workflows made from it with their updates. |
DELETE /api/templates/:id | Delete it. Workflows made from it keep running, with no template to update from. |
POST /api/templates/:id/releases | Publish a release: { label, notes? }. |
POST /api/templates/:id/render | Fill it in: { name, parameters, bindings } (adapter type → profile id). Also takes a gallery template's id. |
POST /api/workflows | Create the filled-in workflow with templateId and templateParams: the parameters are checked again here. |
POST /api/templates/:id/update-instances | Update all, or { workflowIds }; acknowledgeMajor for a major release. |
Viewers read; operators and admins save, publish, make workflows and update. The general workflow routes refuse to deploy, turn on, release, roll back, delete or promote a template (409 TEMPLATE).
Audit
| Event | When |
|---|---|
template.created | Save as template. |
template.released | A release is published. |
template.deleted | The template is deleted. |
workflow.created | A workflow made from it, with the template, release and parameter names (never values). |
component.created, component.released | A built-in template's component is installed (builtin names its key). |
workflow.template_update | Workflows moved to a newer template release, and those held back. |
component.update, workflow.call_update | Workflows moved to a newer component or callable workflow release. |