Create notification templates
Notification templates define the format of the information that you want to send in email notifications for specific situations.
Create a notification template
Notification templates are XML files located in the server profile's conf/server/notification-template directory.
Deployment Automation provides a set of built-in templates:
- AgentGoesOffline
- ApplicationDeploymentFailure
- ApplicationDeploymentSuccess
- ApprovalCreated
- ApprovalFailed
- DeploymentReadied
- DeploymentPackageFailure
- DeploymentPackageStarted
- DeploymentPackageSuccess
- ProcessRequestStarted
- TaskCreated
If these notification templates do not suit your needs, you can create new ones.
To create a notification template:
-
Create an XML file.
-
Enter a script.
Note: Notification templates support only Velocity reports. For details about Velocity templates, see the Apache Velocity Project documentation.
-
Save the file in the server profile directory: <da_profile_directory>/conf/server/notification-template
-
Restart the server.
Properties for notification templates
You can use properties from Deployment Automation objects in your notification templates.
The following tables list some of the most useful properties.
Common properties
Property | Description | Type |
---|---|---|
fn | Object with helper functions | DeployTemplateHelper |
snapshot | Object containing data about the application snapshot; nullable | Snapshot |
environment | Object containing data about the environment where the process ran | Environment |
application | Object containing data about the application of the executed process; nullable | Application |
externalUrl | URL of the Deployment Automation server | String |
Process execution request properties
Property | Description | Type |
---|---|---|
workflowTrace | Trace of request execution; nullable | WorkflowTrace |
analysis | Results of the execution, available if workflowTrace is not null; nullable | FilteredAnalysis |
failureAnalysis | Results of the execution, filtered by only failed steps and available if workflowTrace is not null; nullable | FilteredFailureAnalysis |
request | Object with request data | ApplicationProcessRequest |
applicationProcess | Object with application process data | ApplicationProcess |
versions | List of component versions | List<Version> |
properties | Map with process properties. See Examples of property map keys. | Map<String, String> |
user | User who submitted the request | User |
resourceFactory | Provides access to other DA objects | ResourceFactory |
Approval request properties
Property | Description | Type |
---|---|---|
approval | Approval request data | Approval |
tasks | List of approval tasks | List<ApprovalTask> |
appRequest | Object containing data about the process request; is null if compRequest is available (nullable) | ApplicationProcessRequest |
compRequest | Object containing data about the process request; is null if appRequest is available (nullable) | ComponentProcessRequest |
requester | User who submitted the request | User |
scheduledDate | Data of approval | Date |
processId | Process ID | String |
requestType | Type of request | String |
Basic velocity examples
The following examples demonstrate how the notification template properties may be used in common Velocity statements.
![Closed](../../Skins/Default/Stylesheets/Images/transparent.gif)
#if (CONDITION)
***Statements/HTML to output
#else
***Statements/HTML to output
#end
Checking null values:
#if ($snapshot)
<tr><td>Snapshot:</td>
<td>$snapshot.getName()</td>
</tr>
#end
![Closed](../../Skins/Default/Stylesheets/Images/transparent.gif)
#set ($var = "odd")
![Closed](../../Skins/Default/Stylesheets/Images/transparent.gif)
#foreach ($item in $collection)
***Statements/HTML to output
#end
Examples of property map keys
The following list provides examples of keys that can be used in the properties map, or dictionary, for process execution requests:
- applicationProcess.id
- applicationProcess.name
- deploymentPackage.id
- deploymentPackage.name
- dpRequest.id
- dpRequest.user.name
- dpRequest.user.displayName
- dpRequest.user.id
- environment.id
- environment.name
- request.id
- request.user.name
- request.user.displayName
- request.user.id
- server.url
Note: The default templates use getName(), but the listed keys can also be used.
See also: