> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/6/studio/templates/use-templates/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # Create and use templates > Create and test Jinja2 and TextFSM templates in Studio for use in workflow tasks. Templates in Studio are Jinja2 or TextFSM files that filter and reshape data for use in workflow tasks. You build and test them under **Studio > Templates**. When an **Apply Template** task runs in a workflow, it combines data from a preceding task or job variable with a named template and passes the result to subsequent tasks. ## Prerequisites Template Builder uses Jinja2 or TextFSM syntax. Knowledge of the relevant language is required before proceeding. * [Jinja2 documentation](https://jinja.palletsprojects.com/en/3.0.x/) * [TextFSM documentation](https://github.com/google/textfsm/wiki/TextFSM) ## Create a template #### Open the Create dialog Click **Create** at the top of the Studio side nav. #### Select template type Select **Template** from the dropdown. #### Enter template details Enter a name and group, then select a language from the **Type** dropdown. #### Create Click **Create**. The template opens in Template Builder. ![](/_fern-img/afe3ac4b3a22315ba2852c9d766c69e06bf01fa27a0eb388e6c6643d84878826.webp) To open an existing template, select it from the **Templates** section of the side nav, or browse via the collection view by clicking **Search**. ## Template Builder UI Template Builder has three components: | Label | Component | Function | | ----- | -------------- | ---------------------------------------------------------------------------- | | 1 | Data field | Enter example data to be parsed by the template. | | 2 | Template field | Define the template logic. | | 3 | Output field | Preview the result of combining the data and template. Updates in real time. | ![](/_fern-img/7fd880cd21cb69cb1a78dbf95fffb12689272c9ecff4a734bcf5fea602ef866b.webp) ## Define a template Enter template logic in the **Template** field. The syntax depends on the language selected during creation. Enter example data in the **Data** field. This should match the structure your template will receive at runtime — a JSON object for Jinja2, semi-formatted text for TextFSM. The **Output** field shows the combined result in real time. Use this to draft and troubleshoot your template before using it in a workflow. ![](/_fern-img/9cf65b0cc05c7672477aa37e138d06a6420e49ecd8aa9af6c003f801879cb06f.webp) ## Use a template in a workflow In this example, a workflow retrieves interface data from a network switch via API. The response contains dozens of entries, but only interfaces with a role of `voice` are needed. A Jinja2 template filters the response, and the result is passed to a **View Data** task for manual confirmation. In this example, the API response is simulated by a **New Variable** task that creates a `deviceResponse` job variable: ```json { "interfaces": { "ethernet10": { "role": "desktop", "vlan": 1 }, "ethernet11": { "role": "desktop", "vlan": 1 }, "ethernet15": { "role": "printer", "vlan": 5 }, "ethernet22": { "role": "voice", "vlan": 10 }, "ethernet25": { "role": "voice", "vlan": 10 } } } ``` #### Add the Apply Template task Add **Apply Template** to the workflow and set: * `text` — the `deviceResponse` job variable * `template` — `DocsDemo` #### Add the Query task Add a **Query** task and draw a success transition from **Apply Template**. Set: * `object` — the `parsed` output variable from **Apply Template** * `query` — `results` #### Add the View Data task Add a **View Data** task and draw a success transition from **Query**. Set: * `header` — `Voice Interfaces` * `message` — `Ensure that the expected interfaces are designated as 'voice'` * `body` — the `return_data` output variable from **Query** * `btn_success` — `Accept`, `btn_failure` — `Reject` #### Complete the workflow Draw a success transition from **View Data** to the workflow end. ![](/_fern-img/65bd715b0abc6d4ee29906d4ad13fc2a897f1372cc45de2e4090c4f8acda546d.webp)![](/_fern-img/2c79708ebe89414ac96cde3ee28d691dcde97969a01495b86884460cab4d3811.webp) **Apply Templates** (plural) works the same way but accepts arrays. The `text` and `templates` fields each take an array, and items are paired by index: `text[0]` with `templates[0]`, `text[1]` with `templates[1]`, and so on. > Create and test Jinja2 and TextFSM templates in Studio for use in workflow tasks.