Generate Formatted or structured EMAIL using CBMA
We could generate the alert emails using CBMA. But here I will describe the steps to generate the structured alert email .
You can follow the blog Interface specific Email Alert in PO using CBMA until Step3 and configure the alert. But instead of Step4, follow below steps.
- Create a text File which will act as a template of the email body like below.
You can use the below list of variables in the template file to get the corresponding value from RunTime.
$severity$: Alert Rule severity
$alert_rule_id$: Alert Rule internal ID
$alert_rule_name$: Alert Rule name
$timestamp$: Alert creation time
$pi_component$: SLD instance name of the PI component that created the Alert
$scenario_id$: internal Integrated Configuration or IFLOW scenario ID
$scenario_name$: a readable scenario name for the Integrated Configuration or IFLOW scenario (note: this variable is only available with
the patch from note 2160374)
$error_category$: Error Category
$error_code$: Error Code
$error_label$: Error Label
$error_text$: Error Text
$error_parameters$: Additional error parameters
$msg_id$: Message ID of the PI message
$msg_from_party$: Sender Party of the PI message
$msg_from_component$: Sender Component of the PI message
$msg_to_party$: Receiver Party of the PI message
$msg_to_component$: Receiver Component of the PI message
$msg_interface$: Interface Name of the PI message
$msg_interface_namespace$: Interface Namespace of the PI message
$uds_attributes$: User Defined data from the PI message
$adapter_type$: Adapter Type
$adapter_namespace$: Adapter Namespace
$channel_name$: Communication Channel name
$channel_party$: Communication Channel party name
$channel_component$: Communication Channel component name
$monitoring_url$: URL link to Message Monitoring for the failed message (Http URL)
$secure_monitoring_url$: URL link to Message Monitoring for the failed message (Https URL)
- Upload that text file in such a PO directory so that the location/file is readable by PO system. In my case I uploaded that under “/usr/sap/instanceID“
- Once uploaded,we need to schedule the AlertConsumerJobV2.
To do that go to NWA> Operations > Jobs > Java Scheduler > Task.
Click on Add and then select AlertConsumerJobV2.
Click Next and there you can change the TaskName and Description as per your wish. I kept that as it was.
On the next page you need to provide the parameters like EmailTemplateFile,Consumer,MailFrom,MailTo etc.
In my case I kept the below values.
Consumer:ALERT-TO-STRUCTURED-MAIL(This is the consumer which is used/created in the AlertRule in ID)
MailFrom:The alert email generator email ID
MailTo:The desired recipient for this alert
Then click on next and schedule the alert.
Now click On Finsh.
Now the alert email should be looking like below.