Tokens (Merge Field)
Tokens helps you to generalize your template’s dynamic information and standardize the document creation process.
What is a token?
Tokens help you to generalize your template’s dynamic information and standardize the document creation process. These tokens can automatically populate a Recipient’s Name, email address, Company name, and more.The format for token is {{company_name}}, {{client.name}}. Think of the information that is always changing in your document, then replace that with a token.
The token cannot contain any spaces in between.
Special characters are not supported in tokens. Tokens only support underscores (_) and nested tokens are separated by a dot (.)
Token names should not start with an underscore (_) except for predefined tokens.
Token names cannot contain any special character except underscore(_).
Token with special characters
To insert a token containing spaces and special characters, it should be enclosed with square brackets. For example:
{{[company name]}}
{{[Discount %]}}
{{[Invoice #]}}
Tokens with special characters can be used inside formatters. Examples:
{{upper [First Name]}}
{{abbreviate [Full Name]}}
{{multiply [Sub Total] [Discount %]}}
Note: Closing square bracket character ]
cannot be used as a token name.
Predefined tokens
These tokens are predefined by Docupilot. They will automatically populate certain information specific to your document. (Ex. Current Date and Date Time with timezone)
Here is a list of all available predefined tokens:
Token | Description |
{{_date}} | Displays the current date. |
{{_datetime}} | Displays the current data and time with Timezone support. |
{{_auto_number}} | Displays unique number in the document. You will need to define a starting number in template preferences and with each document that is generated, this number will be incremented by 1. |
Auto Number
Auto Number feature allows you to generate unique number in the document. This feature will be useful if you are generating invoices, tickets, or other documents that need unique number in the document. You will need to define a starting number and with each new document generation, we will automatically increment that number. You can always reset it back to the number of your choice.
To display the Auto Number in your generated document, or in the output file name, or if you want to use it inside a delivery configuration you will need to use the token {{_auto_number}}
in respective content/configurations. You can set the starting number in Preferences page -> Advance settings
Conversion of token to plain text
When a token is preceded by a '\'
(backslash) then it is considered as plain text and is printed in the output document.
Examples:
Input | Output |
| {{name}} |
| {{client.name}} |
| {{[Company name]}} |
Dynamic Tokens
Tokens can be generated dynamically inside a template by using the var helper in tandem with the concat helper.
Token | Value passed | Final token |
---|---|---|
{{var (concat Title "value")}} | Title: Final | {{var "Final_value"}} |
{{#each (group_by firms lookup=”firmname”)}} {{var (concat key "_brand_value")}} {{/each}} | firmname: Google | {{var "Google_brand_value"}} |
Last updated