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:
JSON:
{
"Name": "John Doe",
"OrderNumber": "171024"
}
Result:
Plumsail tokens can also be used in more complex ways, allowing you to
format values, ex. {{date|format(dd.MM.yyyy)}}
.
perform object operations, as well as logical operations.
automatically display properties from some object, ex. {{companies.name}}
, {{companies.projects.name}}
.
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:
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: