---
title: Templates
slug: manufacturing-connect/templates
createdAt: 2022-03-30T21:44:17.000Z
---

Templates contain pre-configured settings and configurations for edge devices. From the *Templates&#x20;*&#x70;ane you can create a template from an edge device or upload a template from a file for your edge devices.

You can access all templates available from the Templates pane. You can create a template from an online edge device or upload a template from a file for an edge device. 

- **Instance**: Upload from the Admin Console.
- **Company**: Upload from a file.
- **Project**: Upload from a file, or create one from an edge device.

Templates for edge devices can include devices, analytics, flows, and connectors. You can make selections for these categories when creating a template from an edge device.

:::hint{type="info"}
**Important**: Before you can create a template from a device, you must add at least one online edge device in **Edge Devices**.
:::

Templates can be scoped at three levels:

- **Instance**: Available to all companies in this Manufacturing Connect instance.
- **Company**: Available to all projects in this company.
- **Project**: Available only to this project.

You can select the scope for a template when you upload. For example, if you upload a template from the **Company** > *Templates* pane, the template is accessible to all the projects for that company. If you upload a template from a **Project** *Templates* pane, the template is accessible to only that project.

When you modify a template, you can modify the scope by selecting **Company** or **Project** in the *Edit Template* dialog box.

You can apply, modify, parameterize, download, and remove a template from the *Templates* pane.

Templates support apply modes, validation checks, in-template parameters, and restore. These capabilities aren't limited to a separate category of template. Every template uploaded through the **Simple Template** option of **Load Template from File** supports them, subject to the template's schema version. See *Applying a template* and *Reusable values* below. **Parameterized Template** (.zip) is a separate, older mechanism for adding substitutable variables to a template, with its own editor.&#x20;

:::hint{type="info"}
**Important:** The **Parameterize Template** action is available only for templates that have a version of 1.x in the template file, for example templates exported from Manufacturing Connect Edge 4.2.0 or earlier. Templates exported from Manufacturing Connect Edge 4.3.0 or later have a version of 2.0.0 in the template file, and the action is not shown for them.
:::

For these templates, add a parameters block inside the template file. Use \{"\_\_param\_\_": "\<name>"} wherever a value should be filled in when you apply the template. Upload the file as a **Simple Template**. Manufacturing Connect then asks for the values in the **Parameters** step when you apply the template.

If you upgraded from an earlier version of Manufacturing Connect, templates that you created before Manufacturing Connect 3.0.0 show 1 in the list, whatever the file contains. The **Version** column in the template list is not the same as the version field in the file. Manufacturing Connect decides which method applies from the file, not from the list.

You can use a single JSON file, provide different values for different devices or sites, check the template before applying it, and apply it to one device, several devices, or a device group. You can also review the template contents, choose an apply mode, and restore a saved device configuration after supported apply operations.

## Access template UI

**To access templates UI**:

1. Log in to Manufacturing Connect.
   &#x20;The *Status Overview* pane by default appears.
2. From the Navigation panel, select **Edge Management**.
   *Edge Management* pane appears, by default the *Edge Devices* tab displays.
3. From *Edge Management* pane, select **Templates**.
   *Templates* tab appears.

Refer to the following actions you can take on the Manufacturing Connect User UI's *Edge Management's* *Templates* tab. The user interface below is for Manufacturing Connect version 2.11.0 and later.

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ZiFE9swLrn7j9hWaSGT81_image.png" size="80" width="1518" height="662" caption="Manufacturing Connect User UI : Templates" position="center" darkWidth="1518" darkHeight="662" showCaption="true"}

&#x20;From the templates page, you can use the icons at the top right to:

- Filter templates by description
- Create a template from an edge device
- Create a template from a file
- Reload the template list

### Template statistics

To view detailed information about a template, click **Show template content** in a template row to display the **Template & Log Details&#x20;**&#x70;anel. The panel contains three collapsible sections: Details, Template Content, and Log.

- **Details**: Displays basic information about the template, including its created and modified timestamps.
- **Template Content**: Displays all components included in the template, to provide a quick overview of what the template provisions when applied. Expand a category to see the names of individual items. When you create or import a template, you choose the settings to include from a set of categories. Categories include:&#x20;
  - **OPC UA**: OPC UA configuration.
  - **Device Management**: Settings such as dns, ntp, country, timezone, dockerConfig, firewall, and proxy.
  - **Auth**: Authentication configuration.
  - **Marketplace**: Marketplace apps and configuration.
  - **Analytics**: Analytics flows and processors.
  - **Digital Twin**: Digital Twins models and instances.
  - **Cloud Storage**: Cloud storage configuration.
  - **System Info**: System information and application configuration.
- **Parameters**: Displays the template's parameters, grouped by component, if it has any. Only templates with a version of 2.0.0 or higher in the template file can have parameters. You declare them in the template file before you upload it. See *Declare parameters in a template file*. To supply values when you apply the template, see *Applying a template*.
- **Log**: Audit history of significant actions including edits and deployments. View the time of the action, severity level, user who performed the action, and event type.

A  template file is a single JSON file. Alongside your selected settings, it records details like the template's schema version and information about the source device, for example:

:::CodeblockTabs{indent="2"}
```json
   {
    "version": "2.0.0",
    "createdAt": "...",
    "updatedAt": "...",
    "stats": {
      "timeseries_db": { "enabled": true, "source": "internal" },
      "version": { "Git": "ca5c1e6b47", "Version": "2.5.4" }
    }
  }
```
:::

### Applying a template

Templates support the following apply modes:

- **Reset & Apply**: Clears all existing configurations and replaces them entirely with the selected template.
- **Merge & Apply**: Combines the template with your current setup. Objects with existing IDs are overwritten, and objects with new IDs are appended, within all components.
- **Apply**: Uses the standard system logic to integrate the template. Overwriting and appending rules are determined at the component level.

Before applying a template, Manufacturing Connect checks that the JSON file is valid, that references in the file are valid, and that the target device has the required connectors and drivers.

Manufacturing Connect checks a template twice: once when you import it and again when you apply it. On import, Manufacturing Connect confirms the file is valid JSON and that everything it refers to is included in the same file. For example, a Digital Twin instance must include the model it uses. On apply, Manufacturing Connect confirms the target device has the connectors and drivers the template needs. If either check fails, Manufacturing Connect reports the problem and doesn't proceed. A failure of one item during the apply itself is separate from these checks. If one item fails, Manufacturing Connect continues applying the rest of the template instead of stopping.

**To apply a template:**

1. In the *Templates* pane, open the template's action menu and select **Apply Template**.
2. On **Select edge devices**, select one or more target devices, then select **Next**. A device that can't receive the template shows the reason inline in an **Info** column instead of being selectable.
3. On **Application mode**, select **Reset & Apply**, **Merge & Apply**, or **Apply**, then select **Next**.
4. If the template has parameters, Manufacturing Connect shows a **Parameters** step: "Fill in the parameter values for the components in this template." Parameters are grouped by component, each with an editable **Value** field pre-filled with its default. Update any values you need, then select **Next**.
5. On **Review**, check the summary, type **I understand** to confirm, then select **Apply**. Manufacturing Connect shows the result for each device and confirms when the apply finishes.
6. Select **Finish** to close the wizard.

Review these behaviors before applying a template:

- Flows in the template can replace existing flows on the device, depending on the apply mode.
- If a connector in the template shares a name with an existing one, Manufacturing Connect adds the new one under a different name instead of overwriting the original.
- With **Reset & Apply**, device tags that aren't in the template are removed.
- If one part of a template fails to apply, Manufacturing Connect keeps applying the rest.
- If the template has protected passwords, save the encryption key. You need it to import the template again.

:::hint{type="info"}
**Note:** Starting with Manufacturing Connect 2.33.0, Manufacturing Connect Edge templates are synchronized with encrypted credentials by default to keep secrets out of source control in Manufacturing Connect templates and Git. Templates support encrypted credentials beginning with Manufacturing Connect Edge 4.0.4.
:::

## Reusable values

A template's JSON file can declare named, typed parameters for the components it targets, such as a site identifier or a Digital Twin model name, letting one template's values be adjusted per device or site instead of being fixed in the file.

Only templates with a schema version of 2 or higher support this, such as templates from Manufacturing Connect Edge 4.3.0 or later. You can't create or edit these parameters in the *Templates* pane, and the **Parameterize Template** action isn't available for them. The parameterized JSON is prepared outside Manufacturing Connect and uploaded like any other template, through the same **Simple Template** upload option. When you apply a template that has parameters, Manufacturing Connect shows them in the apply wizard's own **Parameters** step, grouped by component, each pre-filled with its default value and editable before you continue.

## Compare ways to add parameters

Manufacturing Connect supports two ways to add parameters to a template. Which one you use depends on the template.

| **Item**                    | **Variables added in Manufacturing Connect**                                                         | **Parameters declared in the template file**                                                                     |
| --------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Templates it applies to** | Templates that use variables added in Manufacturing Connect, such as a Parameterized Template (.zip) | Templates with a schema version of 2 or higher, such as templates from Manufacturing Connect Edge 4.3.0 or later |
| **How you add them**        | In Manufacturing Connect, with **Parameterize Template**                                             | In the template file, in a `parameters` block                                                                    |
| **Where you enter values**  | The *Set Variables* dialog box                                                                       | The **Parameters** step in the apply wizard                                                                      |
| **Edge device version**     | Works with versions of Manufacturing Connect Edge earlier than 4.3.0                                 | Manufacturing Connect Edge 4.3.0 or later                                                                        |

## Declare parameters in a template file

You can declare parameters inside a template's JSON file. When you apply the template, Manufacturing Connect asks for a value for each parameter in the **Parameters** step. You can then reuse one template for different edge devices or sites.

Use this method for templates that have a version of 2.0.0 or higher in the template file, such as templates exported from Manufacturing Connect Edge 4.3.0 or later. You write the parameters in the file and upload it. You can't add them in the *Templates* pane.

:::hint{type="info"}
**Note:** The **Version** column in the template list is not the same as the `version` field in the template file. Manufacturing Connect records the list value when you upload or create a template, starting in Manufacturing Connect 3.0.0. Templates created earlier show 1 in the list. Manufacturing Connect decides how to handle a template from the version in the file, not from the list.
:::

### Parameter structure

Declare parameters in a top-level `parameters` block. Group them by scope:

- `_global` for parameters shared by all components in the template.
- The name of a component, for parameters that apply to that component only.

If a component parameter has the same name as a `_global` parameter, Manufacturing Connect uses the component parameter for that component.

Each parameter has the following fields.

| **Field**    | **Description**                                                                                      |
| ------------ | ---------------------------------------------------------------------------------------------------- |
| UniqueName   | The name of the parameter. It must be unique within its scope. You use this name in the placeholder. |
| Description  | A short description of the parameter.                                                                |
| DataType     | The type of the value: `STRING`, `INTEGER`, `FLOAT`, or `BOOLEAN`.                                   |
| DefaultValue | The value that the **Parameters** step shows by default. Write it as a string for every data type.   |
| UserValue    | Set to `null` in the file.                                                                           |

### Data types

| **Data type** | **Value format**                                       |
| ------------- | ------------------------------------------------------ |
| STRING        | Text. Manufacturing Connect uses it as written.        |
| INTEGER       | A whole number with no decimal point.                  |
| FLOAT         | A number that uses `.` as the decimal separator.       |
| BOOLEAN       | `true` or `false`. The capitalization does not matter. |

If a value does not match its data type, Manufacturing Connect reports the error for that parameter and does not apply the template.

### Placeholders and example

To use a parameter, replace the value in the template with a placeholder that names the parameter:

:::BlockQuote
"name": \{ "\_\_param\_\_": "siteId" }
:::

The placeholder is valid JSON, so you can still open and validate the file in a JSON editor.

The following example declares one `_global` parameter named `siteId`.

:::BlockQuote
"parameters": \{
&#x20; "\_global": \[
&#x20;   \{
&#x20;     "UniqueName": "siteId",
&#x20;     "Description": "Site identifier prefix, for example NYC-01",
&#x20;     "DataType": "STRING",
&#x20;     "DefaultValue": "SITE-XX",
&#x20;     "UserValue": null
&#x20;   }
&#x20; ]
}
:::

### Add parameters to a template file

**To add a parameter to a template file:**

1. Open the template JSON file in a text editor.
2. Confirm that version is 2.0.0 or higher.
3. Add a top-level parameters block, or open the existing one.
4. Under `_global` or the component name, add the parameter with its fields.
5. Replace each value that the parameter controls with a placeholder.
6. Save the file.
7. Upload the file as a **Simple Template** through **Load Template from File**.
8. Apply the template. In the **Parameters** step, enter a value for each parameter.

Manufacturing Connect validates the template when you upload it and again when you apply it.

You can't apply a template that declares parameters to an edge device that runs a version of Manufacturing Connect Edge earlier than 4.3.0. Manufacturing Connect shows the version that you need.

## Saved configurations and restore

Before **Reset & Apply&#x20;**&#x6F;r **Merge & Apply&#x20;**&#x63;hanges a device, Manufacturing Connect saves that device's current configuration. If the result isn't what you expected, you can restore the device from this saved configuration.

## Tracking, visibility, and reporting

Manufacturing Connect logs template activity, including creating, importing, editing, deleting, downloading, and applying templates. Each entry shows who did it, when, and the result. A template's details also show which devices or groups use it, its version, and the result of its last apply.

## Limitations and considerations

- Apply modes, the apply preview, and in-template parameters require Manufacturing Connect Edge 4.3.0 or later on the target device.
- You cannot apply only selected parts of a template or combine two templates in this release.
- Saved configurations use storage and do not expire automatically.
- Templates that include Marketplace settings might not work on builds without Docker support.

| **Action**                                                                                                                                | **Details**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \[1] **Show filter**                                                                                                                      | Search by *Description.*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| \[2] **Create Template from device**                                                                                                      | At least one Edge device must be connected to use this option.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| \[3] **Load template from file**                                                                                                          | Upload a Simple Template (`.json`) or Parameterized Template (`.zip`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| \[4] **Reload Template list**                                                                                                             | Update the list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| \[5] [Parameterize a Template](https://docs.litmus.io/edgemanager-2-31-x/lem-user-ui/product-features/templates/parameterize-a-template)  | See link for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| \[6] **Actions**                                                                                                                          | - **(Project-View only) Apply Template: &#x20;**<br />- [Apply a Parameterized Template](https://docs.litmus.io/edgemanager-2-31-x/lem-user-ui/product-features/templates/apply-a-parameterized-template)<br />- [Apply a Parameterized Template During Activation](https://docs.litmus.io/edgemanager-2-31-x/how-to-guides/lem-user-ui-guides/apply-a-parameterized-template)<br />- **Edit Template:&#x20;**&#x54;emplate scope cannot be changed from *Company* to *Project.*<br />- [Parameterize a Template](https://docs.litmus.io/edgemanager-2-31-x/lem-user-ui/product-features/templates/parameterize-a-template)<br />- **Download Template:&#x20;**&#x41; `.json` file. When downloaded from the Company List Templates UI, the file contains information on all projects for the company. When downloaded from the Project List Templates UI, the file contains information on only the project.<br />- **Delete:&#x20;**&#x44;eleting a template makes it unavailable for users to apply. Download the template prior to removal so it can be re-uploaded if necessary. |
| \[7] **View Template Statistics**                                                                                                         | View usage information for a template.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

# Next Steps

- [Parameterize a Template](https://mc-docs.litmus.io/manufacturing-connect/parameterize-a-template)
- [Apply a Parameterized Template](https://mc-docs.litmus.io/manufacturing-connect/apply-a-parameterized-template)
- [Apply a Parameterized Template During Activation](https://mc-docs.litmus.io/manufacturing-connect/apply-parameterized-template-during-activation)

