Writing Notifications

Writing notifications is a blend of writing standard email notifications and data from the platform. Each notification offers both HTML and plain text options. This allows HTML content including headers, footers, and tables as well as use of company "letterhead" and signatures that are used on other company messages.

Reuse

To allow for greatest ease when creating new templates, it is recommended that standard, re-used components of the messages be created as snippets. You can see in the existing snippets that snippets can be created for purely HTML (non-visible) structure (eg. headers and footers) as well as visible standard components like logos, greetings, and signatures.

It is important, when creating snippets that will be used across various templates, that dynamic values be used only if they will be present in all the templates, the snippet will be used in. Be cautious, in particular, about using submission dynamic variables. Different submissions may have different questions/values available. Standard fields used across all submissions (e.g. Requested For Display Name) are probably safe, but using any submission values contains a certain amount of risk.

Dynamic Values

dynamicValues

Dynamic values are values from the platform that can be used in templates and snippets. Once you put your cursor at the desired point in your notification, you can select a value from the dynamic values drop down and the system will put the appropriate reference for that variable in your notification. This reference will be replaced at runtime with the appropriate value.

Submission and Form dynamic values are limited unless you select a kapp and a form from the provided menus. Once a kapp and form are selected, additional options will display that match that particular form. Be cautious using submission values, as they may tie the notification to one specific form.

dynamicValues2

Dates

To apply a date format that has been set up, you need to first select the reference that has been included for a particular date field and then select the dynamic variable option for Date Formats.

dynamicValues3

The result is that the reference has date appearance information added into it for use at runtime:

${appearance('${submission('createdAt')}${format('Month DD, YYYY (no time)')}')}

Other Variables

It is possible that you would want to use information in the notification that was not avaiable from one of the available dynamic values. This could be data that was created or looked up in the worfklow. For example, if the workflow created a Service Now ticket, the other variables could be used to reference the reference id for that ticket. These additional variables are passed into the notification routine at run time using a json with the additional variables.

example
{"Ticket Number": "<%= @results['Create Ticket']['Incident Number'] %>"}