How To Configure Templates for WAAE Email Notifications

Document ID : KB000073099
Last Modified Date : 04/01/2019
Show Technical Document Details
Introduction:
In WAAE 11.3.6 SP7, the a new email notification template feature was added to allow customized emails to be sent for the job email notifications. This article provides details about how to implement this new feature in your environment. It also assumes that you have already configured your instance for email notifications. Details about how to configure an instance for email notifications can be found here...

https://docops.ca.com/ca-workload-automation-ae/11-4-2/en/administrating/ae-administration/send-email-notifications

 
Environment:
CA Workload Automation AE r11.3.6 SP7
CA Workload Control Center r11.4 SP6
Instructions:
The first step is to create a custom template to be inserted into the WAAE database as a global blob. A sample_template file has been provided in $AUTOSYS/install/email_templates (%AUTOSYS%\install\email_templates) to use as a starting point. Create a copy of the sample_template file and edit the copy so that the original is preserved for future reference.

The template file contains four headers: [SUCCESS], [FAILURE], [TERMINATED], [ALARM]. You can configure the template information under each header to control the content of the email sent for each event described by the header. Here is an example of the template for [FAILURE]...

[FAILURE]
SUBJECT=CA Workload Automation - Job: <<<job_name>>> Status: <<<job_status>>> DO_NOT_REPLY
MESSAGE=[start]
------------------------------------------------------------------------------
 CA Workload Automation - Automated Email Notification
------------------------------------------------------------------------------
 Instance:                                                    <<instance>>
 Scheduler host:                                              <<scheduler_host>>

 Job name:                                                    <<job_name>>
 Status:                                                      <<job_status>>
 Job run machine:                                             <<run_machine>>
 Job run identifier:                                          <<run_identifier>>
 Job start time:                                              <<start_time>>
 Job completion time:                                         <<completion_time>>
 Exit code:                                                   <<exit_code>>

------------------------------------------------------------------------------
 Note: This email was automatically generated based on the job definition.
 Please do not reply.
------------------------------------------------------------------------------
[end]
STDOUT=no
STDERR=no
LOG_LINES=1000

The template info under each header includes the following fields...

SUBJECT - Sets the subject of the email that is sent
MESSAGE=[start]...[end] - All text between the [start] and [end] tags makes up the body of the email message
STDOUT - set to 'yes' if you want the standard output file of the job to be attached to the email (command jobs only)
STDERR - set to 'yes' if you want the standard error output file of the job to be attached to the email (command jobs only)
LOG_LINES - sets the maximum number of lines to be included in the STDOUT and STDERR files that are attached. If this value is set to '0', the entire files are attached.

In the SUBJECT and MESSAGE fields, the following standard tags, jil attribute tags, and global variable tags can be included...

Standard tags:

Instance: <<instance>>
Specifies the name of the CA Workload Automation AE instance.

Scheduler host: <<scheduler_host>>
Specifies the host name of the scheduler.

Job name: <<job_name>>
Specifies the name of the job.

Status: <<job_status>>
Specifies the status of the job.

Job run machine: <<run_machine>>
Specifies the name of the machine where the job runs.

Job run identifier: <<run_identifier>>
Specifies the job run identifier.

Job start time: <<start_time>>
Specifies the time that the job starts.

Job completion time: <<completion_time>>
Specifies the time the job completes by.

Alarm name: <<alarm_name>>
Specifies the name of the alarm.

Alarm message: <<alarm_message>>
Specifies the message to include in the alarm.

Exit code: <<exit_code>>
Specifies the exit code of the job.

JIL attributes:

Command: <<command>>
Specifies the command to run the job.

Job Description: <<description>>
Specifies the description of the job.

Application: <<application>>
Specifies the name of the application that is associated with the job.

Group: <<group>>
Specifies the name of the group that is associated with the job.

Profile: <<profile>>
Specifies the name of the profile that is associated with the job.

Machine: <<machine>>
Specifies the name of the machine where the job runs.

Note: You can include any JIL attribute in the notification template in the jil_attribute: <<jil_attribute>> format. In the notification, <<jil_attribute>> is replaced with the attribute value.

Global variables:

Global Variable: <<$$GV1>>
Specifies the global variable upon which the job depends.

After you have created your template file and saved it, you will need to insert the file into the WAAE database as a global blob. To do this, run 'jil' and enter the following at the jil prompts...

1>insert_glob: template_name (can be any name you want)
2>blob_mode: text
3>blob_type: emailtemplate
4>blob_file: path and filename of your saved template file
5>exit

Once the template has been inserted as a global blob, you can now use it in job definitions. At a minimum, a job must contain the following attributes to send email notifications using a template...

send_notification:
Details about this attribute can be found here...
https://docops.ca.com/ca-workload-automation-ae/11-4-2/en/reference/ae-job-information-language/jil-job-definitions/send_notification-attribute-specify-whether-to-send-a-notification

notification_template: template_glob_name
Set to the name used in the 'insert_glob' jil attribute when inserting the template


notification_emailaddress: email_address
Set to the email address that will receive the notification. Further details about this attribute can be found here...
https://docops.ca.com/ca-workload-automation-ae/11-4-2/en/reference/ae-job-information-language/jil-job-definitions/notification_emailaddress-attribute-identify-the-recipient-of-the-email-notification-by-email-address