Test template with your data

You can test the document template to see an example of the resulting file from the Editor.

Testing from editor

After you finish designing your template in the editor, you can save and test it to see how your modifications affect the result.

Test template from editor step

Have in mind that, while working with DOCX templates, you may see a mismatch alert in the toolbox.

Mismatch error in Online editor

This alert triggers if your template syntax doesn’t match the process engine.

To learn more about the specific syntax rules and differences, see our guide on Modern and Classic DOCX engine.

What to do after you clicked on the Test template?

After that, you will see a panel with dropdown. There are three options for testing the template - Web forms, Auto-generated form, and JSON.

Test template panel

Web forms

If you want to design your own form for the testing select the gear button in the dropdown menu.

Web forms

It opens a page where you can bind an existing form or create a new one clicking on the Create new form button with Plumsail Forms application.

Note

Please find additional information on creating custom Plumsail forms in the article.

Bind new form

Auto-generated form

The process automatically creates a testing form based on tokens from the template. You just complete it and press Test & Download button to download the result or Test & Preview to open the result in a new browser tab.

default form fields

It’s possible to adjust the testing form by changing token types.

Important

Nesting tokens referring to the single object, not the collection of items, won’t work in the testing form. Thus, if you have some nesting tokens like {{company.name}}, {{company.address}}, get rid of a dot operator and change them to simple tokens like {{companyName}} and {{companyAddress}}. Alternatively, you can keep them and submit JSON for testing the template.

JSON

Insert a JSON object representing the data for the document template and click on the Test & Preview button. This type of testing may be useful if your document template is complex or you already have JSON output from third systems.

JSON

Note

Once you tested the template you can configure how to deliver the result document (email, OneDrive, etc). Just click the Save & Next button in the Configure template step.

Troubleshoot template errors

Note

Only available for the Modern Engine.

Learn more about the difference between the Modern and Classic syntax.

Using testing mode, it’s possible to have a better understanding of which errors are present in your template and the reason behind them. This will help you generate files smoothly and take your processes to the next level.

So once your template is ready, verify that you are using Test mode and click Settings.

Template testing mode

Next, select DOCX as output file type and save the changes.

Template testing output type

Note

Template error details are available only in Testing mode. In Production mode, tokens that contain errors are omitted and replaced with empty values so that document generation can continue.

Then click Test template, provide your data and choose Test & Preview or Test & Download.

Template test and available options to preview or download the result

If your Modern engine template contains errors, Plumsail Documents displays them when you test the process. The preview displays a list of token errors found in the template. Use this list to identify tokens with invalid expressions, incorrect data paths, or unsupported syntax.

Modern engine preview showing token errors found in a DOCX template

To view error details directly in the generated document, download the test file. Plumsail Documents adds comments to help you troubleshoot template issues. Each comment contains the following information:

  • Error identification: This section indicates which specific process failed.

  • Problem description: A brief summary of the error.

  • Details: Shows the path within your JSON data (or any other input) related to the issue.

How it looks in the document:

Template test with errors

Common cases

Having clear and structured input is essential for our engine to work properly, and make the most of its features. That means having a complete and consistent data set from the desired source, along with a template designed accordingly.

Any inconsistency will likely result in errors during the evaluation and processing of the output documents.

Let’s start with an example JSON input:

{
  "order": {
    "status": 1,
    "items": [
      {
        "name": "Keyboard",
        "quantity": 12,
        "price": 80,
        "paid": "false"
      },
      {
        "name": "Printer",
        "quantity": "10",
        "price": 250,
        "paid": true
      }
    ]
  }
}

As you can see, for explanation purposes, the data is not consistent. Based on it, we can start unfolding some common errors and how to work through them.

Missing token

Template

Error message

Comments

{{#link company “Link here”}}

Error during processing this token:
"Tag replacement error"
Variable company not found

Our template is referencing a company value that doesn’t exist in our source JSON, leading to an error.

Mismatching field types

Our engine relies on specific value types for functions and operations. If these types don’t match, the function won’t execute properly.

Math operations

Template

Error message

Comments

{{order.items.total=@value.quantity*@value.price}}

Error during processing this token:
"Error in expression evaluation."

Invalid value.
Path to data related to this error:
- @value.quantity
- Multiplication
- @value.price

Multiplication fails between a string value ("10") and a number (250).

Calculated properties

Template

Error message

Comments

{{order.isValid=order.status=="Active"}}

Error during processing this token:
"Error in expression evaluation."

Unsupported operation: ==

Comparison between string values ("Active") and numbers (1) is not possible.