Skip to main content

Template

The Template activity fills a published template with data from the workflow and returns the result.

When to use it​

Use it to build a request body, a document, or a message from workflow data, and to reuse the same text across workflows. For a one-off value, map it directly instead.

Configuration​

FieldRequiredDescription
NameRequiredThe name of this activity.
DescriptionOptionalA description of this activity.
TemplateRequiredThe template to use. Only templates with a published version are listed: the organization's templates and those of the selected workspace. A version list appears after you select a template and defaults to the latest.

Input​

Map the values the template reads as the activity's input. The input fields come from the placeholders in the selected version, for example customer.name for {{customer.name}}.

Output​

Map the result as the activity's output.

FieldDescription
useTemplateOutput.outputThe rendered result. For a JSON template, the parsed JSON. For XML, HTTP (HTML), and Text templates, a string. JSON values are escaped as JSON strings, XML and HTTP (HTML) values for markup, and Text values are not escaped.

Example​

A JSON template named Order confirmation reads order.id. Map the order ID to order.id, then map useTemplateOutput.output to the body of the next REST activity.

Common errors​

ErrorCauseWhat to do
TEMPLATE_VERSION_NOT_FOUNDThe version was deleted, or belongs to another organization or workspace.Select an available version.
TEMPLATE_SYNTAX_ERRORThe template text does not compile.Fix the template and publish a new version.
TEMPLATE_RESOURCE_NOT_FOUNDNo template is set, or the template resource is missing.Select a template.
TEMPLATE_RENDER_ERRORThe template failed while running, for example an unknown helper, a helper with the wrong number of arguments, or output that exceeds the render size limits.Check helper names against Template Syntax.
TEMPLATE_INVALID_JSON_OUTPUTThe JSON template rendered text that is not valid JSON.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.