Templates are reusable pieces of text that can use variables to affect their appearance. They can use application data to generate various types of documents such as spreadsheets and emails. Template variables are accessed using special Handlebars Helpers syntax (note the double curly brackets in the example below). 

To better illustrate how the templates look and function, here’s an example:

Hello, dear {{record.name}}!
This is an email from {{app.config.companyName}}, writing to let you know of our recent policy changes.
{{#if param.detail}}
These changes include …………
{{/if}}
Best regards,
{{app.config.companyName}}

Template

Click > +New Template a new page opens.

New Template

Description of fields:

Fields
Description
Template type
HTML
XML
JSON
Plain Text
Other (Enter your content type)
Display mode
Choose between Source and WYSIWYG (a graphical html editor).

Edit your HTML
If Source is selected, enter your html code here. You can use helpers as described below.

Helpers

Template commands are called helpers and are placed between {{double mustaches}}. There are a number of helpers available:

Helpers available in actions (such as when sending emails or SMS):

Field
Description
appIconUrl
Returns the URL of the app’s icon.
Example: {{appIconUrl}}
document
Returns the download link of a document record.
Example: {{document record}}
string
Access localization strings.
Example: {{string “Hello World”}}
formatNumber
Formats a number using dojo number.
Example: {{formatNumber 10 2}}
viewLink
Returns the URL to the specified view. Optionally provide a record to populate the view’s forms.
Example: {{viewLink “mobile” “IssueForm” record}}
{{viewLink “web” “IssueList” null}}
startsWith
True if the specified string starts with the specified value.
Example: {{startsWith str “value”}}
compare
Compare two values.
Example: {{compare 10 “==” 5}}
{{compare 10 “>=” record.number}}
arithmeticOperator
Performs arithmetic operations.
Example: {{arithmeticOperator record.number “+” 10
formatDate
Formats a date.
Example: {{formatDate record.Date ‘short’ ‘long’}}
{{formatDate record.Date ‘yyyy-MM-dd’ timezone=”UTC”}}
formatTimeAgo
Creates a string describing a moment that happened some time units ago. E.g. “15 minutes ago” or “2 years ago”.
Example: {{formatTimeAgo record.When}}
documentUrl
Creates a URL to a document-record.
Example: {{documentUrl record}}
file
Creates a file link.
Example: {{file record}}
resource
Creates a link to a resource.
Example: {{resource “testResource”}}
concat
Concatenates two strings.
Example: {{concat “string1” “string2”}}
capitalize
Capitalizes the first letter of a string.
Example: {{capitalize “hello”}}
decapitalize
Decapitalizes the first letter of a string.
Example: {{decapitalize “Hello”}}
toUpperCase
Converts the entire string to uppercase.
Example: {{toUpperCase “hello”}}
toLowerCase
Converts the entire string to lowercase.
Example: {{toLowerCase “HELLO”}}
monthName
Gets the month name of the specified date.
inlineImage
Example: {{inlineImage record}}

For templates used in actions, the following data is available:

Fields
Description
record
Access the current record. Use ‘.’ to access attributes or relations.
Example: {{record.name}}
{{record.owningUser}}
app
Access the current app. From the app you can access models, config parameters, etc.
Example: {{app.config.paramName}}





Up Next

No Topics.