Skip to main content

Using a Template in a Workflow

Use the Template activity to fill a published template with workflow data and pass the result to a later activity, such as a REST call or an email. The activity uses one version of the template until you choose another.

Before you begin​

  • Publish the template. The activity lists only templates with a published version. Drafts are not offered.
  • Open the workflow in the workspace that can use the template: a Workspace level template for that workspace, or any Organization level template.

Add the activity​

  1. Add the Template activity from the Common group to the workflow.
  2. In the Template field, search for and select a template. The list shows each template with its type. Search matches name, type, level, and description.
  3. Check the version list that appears next to the template. Studio selects the latest published version, shown as, for example, v3 (latest).
  4. Map the template's placeholders as the activity's input. The activity builds the input fields from the placeholders in the template.
  5. Map the result as the activity's output to the next activity. The output is useTemplateOutput.output.

The Template field lists the organization's templates and the templates of the workspace you are in.

An Organization template shows (Organization) after its name. When two templates share a name, the label adds (Workspace) or (Organization), and identical names at the same level add a short code in brackets.

What the output contains​

Template typeuseTemplateOutput.output
JSONThe parsed JSON, so you can map its fields. Placeholder values are escaped as the inside of a JSON string.
XMLA string. Placeholder values are escaped for markup.
HTTP (HTML)A string. Placeholder values are escaped for markup.
TextA string. Nothing is escaped.

Write {{{x}}} to skip escaping for XML and HTTP (HTML) templates.

Keep or change the version​

The activity stays on the version you picked. Publishing a new version does not change it.

When a newer version exists, the field shows Pinned to vN. vM is available. Select Use vM to move to it. Check the Input mapping afterward, because the new version may read different placeholders.

How you know it worked​

The output mapping shows a schema under useTemplateOutput.output, and a test run returns the rendered text. To check without deploying, see Run a Draft Execution.

When it does not work​

SymptomCauseWhat to do
The Template list shows No published templates yet. Create one in Settings > TemplatesNo template has a published version.Publish a version.
The Template list shows No templates matchYour search matches no published template.Change the search text.
The selected template version is no longer available. Choose another.The version was deleted, or you no longer have access.Select another template or version.
This step still uses a template resource. Choose a template above to replace it.The step was built with an older template resource.Select a template in the Template field.
TEMPLATE_VERSION_NOT_FOUNDThe version was deleted, is a draft, belongs to another organization or workspace, or the reference is malformed. A deployment also stops early and names the missing version.Select a published version and redeploy.
TEMPLATE_RESOURCE_NOT_FOUNDNo template is set on the step, or the template resource it points to is missing.Select a template in the Template field.
TEMPLATE_SYNTAX_ERROR or TEMPLATE_RENDER_ERRORThe template text fails when it runs, for example an unknown helper.Fix the template, publish a new version, and select it.
TEMPLATE_INVALID_JSON_OUTPUTA JSON template rendered text that is not valid JSON. The error names the line and column.Check commas, quotes, and braces around placeholders.
TEMPLATE_UNSUPPORTED_TYPEThe template type is not supported.Use JSON, XML, HTTP (HTML), or Text.
TEMPLATE_STORE_UNAVAILABLEThe template store could not be reached. Whether it is retried depends on the retry policy.Retry the run.

Deployments and deleting​

When you deploy a workflow, the template versions it uses are recorded with the deployment. A template with a deployed or pending workflow cannot be deleted. See Managing Template Versions.

Next steps​