In order to proper document generation, System Administrator needs to upload correctly defined document template with tokens.
Token is an element in document, which should be filled from Salesforce data during generation process. Prepared document should be saved as docx file.
Three token types can be used:
- value – text element (example FirstName, LastName)
- table
- image
- condition
- standard system tokens (example today date)
Value tokens
Tokens should be added to document in the following format {{tokenName}}
Token Name should match the name in the Template Configuration in the system.
Example:
Token will be replaced by matched fields from Account object
{{token_account_name}} hires {{token_account_num_of_employees}}
and was created by {{token_account_createdby_last_name}}
Table tokens
First row on table should starts from {{#tableToken}}{{firstColumnFieldToken}} and ends with {{lastColumnFieldToken}}{{/tableToken}}
Example:
Generator will create table based on given contact records
First Name | Last Name | Phone |
---|---|---|
{{#contacts}}{{firstname}} | {{lastName}} | {{phone}}{{/contacts}} |
Image tokens
It allows to insert image into document. Token should be formatted as below:
{{%image | width x hight}}
Width and hight of document is optional. As default, it is set to 100×100
Condition tokens
Condition tokens allow to display a part of text dependent on defined condition logic using {if/else} format. It should be added to the document in the following way:
{{#if.conditionTokenName}}
Text or {{token}} to display when condition is true
{{/if.conditionTokenName}}
{{^if. conditionTokenName}}
Text or {{token}} to display when condition is false
{{/if. conditionTokenName}}
Condition logic should be specified in Template Configuration.
Standard System Tokens
Format | Description |
---|---|
{{c.TODAY}} | Replace token with today date |
{{c.DD}} | Replace token with current day in format 01-31 |
{{c.MM}} | Replace token with current month in format 01-12 |
{{c.YYYY}} | Replace token with current year |
Example
Token will be replaced by date with given format
{{birthDate|dd-MM-yyyy}}