Tokens

Tokens function as placeholders for incorporating dynamic data into documents, acting like variables that get replaced with actual values during document generation.

Enclosed in {{curly braces}}, tokens correspond to specific fields from a data source, such as JSON.

For example, to dynamically insert a client’s name into your template, you might define a token like {{Name}}. When the document is generated, this token will be replaced with the actual name, such as “John Doe”.

Template:

Template

JSON:

{
  "Name": "John Doe",
  "OrderNumber": "171024"
}

Result:

Result

Plumsail tokens can also be used in more complex ways, allowing you to

System tokens

There are two system (predefined) tokens: {{@date}} and {{@number}}. System tokens use @ as a prefix.

  • {{@date}} provides the current date and time.

  • {{@number}} inserts a unique number into your document or Process parameters.

Note

Check out this article for more information about automatic numbering.

Let’s add these system tokens to our template:

Template with system tokens

And use the same JSON data we used earlier:

{
  "Name": "John Doe",
  "OrderNumber": "171024"
}

As we kick off the generation process, this is the result we’ll get:

Result with system tokens

Tokens in Processes

You can see the tokens used in your template by opening the token dialog in Processes.

To open the dialog, click the Tokens button in the template editor:

Tokens dialog

You can also change the types of tokens used in your template. Find out how it works here.

Tokens dialog

Check how the tokens work in: