Notification templates are the basis for emails that the
server sends to users after an event on the server.
About this task
Notification templates are in Apache Velocity format.
You can use this format to put together a message template with scripts
and parameters that are specified when the notification happens. For
example, the template can include information about a process that
started, succeeded, or failed. For more information about creating
templates with Velocity, see https://velocity.apache.org/.
Procedure
- Duplicate an existing template. Starting in version 6.2.0.2, the application templates are in the folder
application_data/conf/server/notification-templates,
where application_data is the application data
folder. The default location is
/opt/ibm-ucd/server/appdata/conf/server/notification-templates on Linux and C:\Program
Files\ibm-ucd\server\appdata\conf\server\notification-templates on Windows. In version 6.0 to 6.2.0.1, the templates are in the folder server_install/conf/server/notification-templates.
- Open the new template in a text editor.
- In the <name> tag, give the new template
a unique name. Each template must have a unique name.
- In the template, add parameters and other information.
To use information from the event that created the notification,
use the parameters in Parameters for notification templates.
For example, if you are creating a notification for an application
process, you can use the parameter $applicationProcess.getName() to
get the name of the process. You can also refer
to properties just like you can in process steps. For example, to
refer to the property
environment.name, use the
following code:
$properties.get("environment.name")
Similarly,
if the step
myStep creates the output property
outputProperty1,
you can refer to the property in the notification template with the
following code:
$properties.get("myStep/outputProperty1")
You use the same syntax to refer to other properties, too. For example, if an
application has an application property that is named
myApplicationProp, you can
refer to that property with the following
code:
$properties.get("application/myApplicationProp")
Similarly, you can refer
to environment properties with code that is similar to the following
example:
$properties.get("environment/myEnvironmentProp")
- Restart the server. The server loads notification
templates at start time, so when you change a template, you must restart
the server before you can use it.
What to do next
Now you can use this template as part of a notification scheme.
See
Notifications.