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
| Field | Required | Description |
|---|---|---|
| Name | Required | The name of this activity. |
| Description | Optional | A description of this activity. |
| Template | Required | The 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.
| Field | Description |
|---|---|
useTemplateOutput.output | The 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
| Error | Cause | What to do |
|---|---|---|
TEMPLATE_VERSION_NOT_FOUND | The version was deleted, or belongs to another organization or workspace. | Select an available version. |
TEMPLATE_SYNTAX_ERROR | The template text does not compile. | Fix the template and publish a new version. |
TEMPLATE_RESOURCE_NOT_FOUND | No template is set, or the template resource is missing. | Select a template. |
TEMPLATE_RENDER_ERROR | The 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_OUTPUT | The JSON template rendered text that is not valid JSON. | Check commas, quotes, and braces around placeholders. |
TEMPLATE_UNSUPPORTED_TYPE | The template type is not supported. | Use JSON, XML, HTTP (HTML), or Text. |
TEMPLATE_STORE_UNAVAILABLE | The template store could not be reached. Whether it is retried depends on the retry policy. | Retry the run. |