Adding or modifying template tokens

Use the information in this section to add or modify template tokens.

Templates contain special tokens specific to the system. These tokens are replaced with dynamic content created by the system whenever content is generated using the template.

Text or HTML outside of these tokens is not modified during the merging of the dynamic content. Templates support cascading style sheets, allowing you to specify the formatting such as fonts, font sizes, foreground and background colors.

This table shows the tokens that you can use in your templates. Tokens are case sensitive.

Token Description
[cell] Returns the data from within a cell of one of the data tables in the notification. You must specify the table, row, and column of the cell. The first row of a table is the column headers.

For example, [cell?table=1&row=2&col=4]

[content] This token is used by master templates to specify where the body of the templates that use this master template should be embedded when notifications are generated.
[datasetdescription] The description of the InfoSet or InfoSets from which the content is loaded.
[description] The description of the notification.
[files] A list of links for the content. The links are those specified by application links for the InfoSets.
[group] The homepage group of the notification.
[if], [else], [endif] These tokens are used to indicate a conditional section of the template. These tokens allow part of the template to be included only if the conditions that you specify are met.

Consider the following:

  • The conditions that you specify are tested by providing the number of the condition and the result for which you want to test.
  • By default AND logic is used, however, you can also combine conditions by using OR.
  • You cannot nest one [if] within another [if].
  • You can use delivered=true to test whether the content is being delivered to a device or is being viewed online.

The following example will only include the logo if this notification is being generated for delivery:

[if?delivered=true]
<img src="http://mycompany.com/logo.gif">
[endif]

The following example will generate one set of content if tables 1, 2, and 3 are empty, and another set of content if any of them have any rows of data.

[if?1=false&2=false&3=false&type=and]
You do not have any High, Medium, or Low priority problems to work on.
[else]
You have [rowcount?table=1] High, [rowcount?table=2] Medium, and [rowcount?table=3] 
Low priority case(s) to work on. See the tables below for details.
[values]
[endif]

The following example will generate the same content as example 2 but uses OR instead of AND.

[if?1=true&2=true&3=true&type=or]
You have [rowcount?table=1] High, [rowcount?table=2] Medium, and [rowcount?table=3] 
Low priority case(s) to work on. See the tables below for details
[values]
[else]
You do not have any High, Medium, or Low priority problems to work on.
[endif]
[instructions] The instructions for the notification. Instructions appear near the top of the notification and instruct a user on why the notification was sent, what it contains, and how the recipient should use it and take action on it.
[link] A list of links for the content. The links are those chosen using the auto-relate feature.
[links] A list of links for the content. The links are those chosen using the auto-relate feature, or are specified by application links for the InfoSets.
[name] The name of the notification.
[owner] The owner of the notification.
[path] The URL to the web context of the system. You can use this token to create links to images and other files that can be displayed by web browsers and email clients.

For a single installation of the system, this token does not have to be used because you can hard code URLs in the templates. If the web context (URL) of the system is likely to change, or you want to create templates that are used at more than one installation, this token can be used to create templates that will not need modification between sites. The system replaces this token with a URL and should be placed, for instance, within HTML IMG tags.

For example, <img src="[path]/img/corporate_logo.jpg">

[renderer=object]

or

[renderer1=object], [renderer2= object]

The system can pass data to other applications, enabling them to render content which is then included in a notification. For example, sales information could be passed to a mapping application which would draw a color coded map based on the data that would be included in the notification sent out by the server.

The [renderer] token specifies an object that renders all of the data tables or a specific data table. The object portion of the token specifies a Java object that will be loaded and allowed to create content to represent a data table. Parameters can be specified for the objects.

Rendering objects may be provided with the system. The same rules that apply to [values] tags apply to [renderer] tags.

[reply-to] The reply to email address associated with the notification. This is the email address that the system uses when a user selects the email reply option.

When you include the reply to in the template rather than the notification, you can make the reply to address conditional. For example, you can use the email address or user ID from a data column, you could specify conditions to select different templates that have different reply to email addresses, or you could use conditions in the data to select a specific reply to email address from a group of email addresses. This approach is useful if you are using notifications that are delivered using bursting.

This example shows how to specify the reply to address: [reply-to=wstegner@xyz.com]

The following example shows how to use an email address that is located in a data table in the notification. This example takes data (the email address) from the first data row of the fourth column of the first table.

[reply-to=[cell?table=1&row=2&column=4]]

The following example shows how to use a user ID that is located in a data table in the notification. This example takes data (a user ID) from the first data row of the fourth column of the first table and appends "xyz.com" to create the email address.

[reply-to=[cell?table=1&row=2&column=6]@xyz.com]

The following example shows how to use conditions. This example sets a reply to address of fred@xyz.com if the first condition in the notification is true and barney@xyz.com if the condition is not true.

[if?1=true]
[reply-to=fred@xyz.com]
[else]
[reply-to=barney@xyz.com]
[endif]
[rowcount] Returns the number of rows in one of the data tables in the notification. You must specify to which table you are referring.

For example, [rowcount?table=2]

[systemname] The name of the system as provided on the System Settings page.

For example, XYZ Corp. Notification System.

[template] This token is used to select a template. The template is used to prepare the content for part or all of the notification. You can use this token to conditionally load another template based on values in the data.

You can use this token to specify the attachment type. All attachments are created as HTML, but you can use different type values to specify that application you want to use to open the attachments. For example:

  • Specify HTML to open the attachment with the default browser.
  • Specify XLS to open the attachment with Microsoft Excel.
  • Specify DOC to open the attachment with Microsoft Word.

Usually the data in the notification is different from the data in the attachment, so the template for the notification and the template for the attachment specify which tables to include.

This token is processed last and can include any other token inside of it. Templates must be uniquely names. the system loads the new template and uses it to generate the notification content. If multiple templates exist with the same name, The system uses the first one it finds. If there is no template with this name, the system uses the original template to generate the notification.

The following example loads a template called Invoice Past Due.

[if?1=true]
[template=Invoice Past Due]
[endif]

The following example specifies the template name and the attachment type.

[template=Line Item Details&type=HTML]

The following example uses templates to display the notification's first table in the email. The second table is attached as a document that is opened by Excel.

Template 1: Invoice Summary
This email is compiled from our records and shows your monthly invoices. The table below shows your invoice summary and the attached spreadsheet contains your line items.
<table>
[values1]
</table>
[template=Invoice Details&type=XLS]
Template 2: Invoice Details
Monthly Invoice Line Items
<table>
[values2]
</table>
[tool_delete] A URL to a web page that allows the user delete the item.
[tool_details] A URL to a web page that displays the online version of the notification.
[tool_disable_next_month] A URL to a web page that allows the user to disable a notification until the start of the next month.
[tool_disable_next_qtr] A URL to a web page that allows the user to disable a notification until the start of the next quarter.
[tool_disable_next_reset] A URL to a web page that allows the user to disable a notification until the notification is no longer tripped.
[tool_disable_next_week] A URL to a web page that allows the user to disable a notification until the start of the next week.
[tool_disable_next_year] A URL to a web page that allows the user to disable a notification until the start of the next year.
[tool_disable_permanent] A URL to a web page that allows the user to disable a notification.
[tool_disable_days_1] A URL to a web page that allows the user to disable a notification for 1 day.
[tool_disable_days_2] A URL to a web page that allows the user to disable a notification for 2 days.
[tool_disable_days_3] A URL to a web page that allows the user to disable a notification for 3 days.
[tool_disable_days_4] A URL to a web page that allows the user to disable a notification for 4 days.
[tool_disable_days_5] A URL to a web page that allows the user to disable a notification for 5 days.
[tool_disable_days_6] A URL to a web page that allows the user to disable a notification for 6 days.
[tool_disable_days_7] A URL to a web page that allows the user to disable a notification for 7 days.
[tool_disable_days_8] A URL to a web page that allows the user to disable a notification for 8 days.
[tool_disable_days_9] A URL to a web page that allows the user to disable a notification for 9 days.
[tool_disable_days_10] A URL to a web page that allows the user to disable a notification for 10 days.
[tool_edit] A URL to a web page which allows the user edit the notification.

For example, <a href="[tool_edit]">Click here to edit</a>

[tool_enable] A URL to a web page that allows the user to enable a disabled notification.
[tool_login] A URL to a web page that allows the user to login to the system.
[tool_options] A URL to a web page that provides the all of the options available for a notification.
[tool_owner] A URL to a web page that provides the user with the details of the owner and send them a message.
[tool_recommend] A URL to a web page that allows the user to recommend the report or notification to another user of the system.
[tool_refresh] A URL to a web page that refreshes the item.
[tools] The system replaces this token with a list of tool links, allowing the user to edit, refresh, disable or delete the notification, recommend it to a friend, or log in to the system.

If the link is in an email, most email clients open a web browser and the user can log in to work with a live web page instead of a static email.

If you do not want the complete list of tool links, individual links can be constructed using the tokens below.

[tripdate] The date and time that the content was created.
[trip_explain] A description of why the notification was triggered or delivered.
[type] The type of the notification.
[values] The system replaces this token with all of the data tables within the notification. Using this token allows a template to work for all notifications.

Each fact or report table within delivered content is created as rows of a table. For this reason all [values] tokens must be embedded within a table tag, allowing the template creator to specify the attributes of the table and to create column headers and footers.

If you do not want the contents of the [values] token to affect any other table structures within the template, place it within its own table tag. For example, <table>[values]</table>.

[values1], [values2] etc.

Specifies where to place specific data tables. The system replaces the [values1] token with the first data table. The system replaces the [values2] token with the second data table.

Note the following:

  • You can reference any number of tables with this token.
  • The tokens do not have to appear in order in the template.
  • You must include [values1] in the template.
  • Other tokens must be number contiguously. For example, you cannot use the [values3] token unless you also include the [values1] and [values2] tokens in the template.
[version] Inserts the current product version into the notification. You would typically use this token in a statement that appears at the bottom of the notification.

For example, This email generated by Customer Support notification system, Version [version].