I was configuring a job on SAP BTP and I noticed the Alert Notification On and Off option. As I could not find any blog about it, but only an unanswered question, I decided to create this blog.
Setting the SAP Alert Notification Event
When we configure a job, there is the possibility of activating Alert Notification. Actually, this configuration works like an event, so we are setting that this job will
trigger an event for the SAP BTP Alert Notification service when it is finished.
Considering the image below, it is configured to trigger the event for success and for error.
Job Configuration
Configuring the SAP Alert Notification
The Job Scheduler will trigger an event for the SAP Alert Notification service, so we need to configure the SAP Alert Notification service to listen to this event and perform some action
To open the SAP Alert Notification service go to your subaccount > Instances and Subscriptions and click on your Alert Notification instance
AlertNotification Service Link
Here we can see the three steps that need to be performed to activate our listener.
Alert Notification Steps
Actions
The action is
what is going to be executed when the SAP Alert Notification receives an event from our Job Scheduler. There are a lot of possible actions like sending an email, sending an MS Teams message, calling a webhook, etc. I am going to configure the email option for this example
Important: There is no possibility to add more than one email according to SAP Help, but a workaround would be to create a new email as a distribution list
This is the complete list of actions:
https://help.sap.com/docs/ALERT_NOTIFICATION/5967a369d4b74f7a9c2b91f5df8e6ab6/8a7e092eebc74b3ea01d50...
Selecting the Action Type
If we do not change the Subject Template, the SAP Alert Notification will send a default subject. The same applies to the payload template.
Advanced Action Properties
Conditions
The condition is a
filter to define which alerts/messages we want to work for our listener.
https://help.sap.com/docs/ALERT_NOTIFICATION/5967a369d4b74f7a9c2b91f5df8e6ab6/35ca5de101fc4d5791cdbb...
For the job scheduler, you can configure it according to your needs using the following help
https://help.sap.com/docs/alert-notification/sap-alert-notification-for-sap-btp/jobscheduler-job-exe...
For example, to receive any Job Scheduler alert/message we can create a condition for the eventType JobSchedulerJobExecution (check the help above to create it correctly)
Condition for JobScheduler
If you want to receive only success alerts, for example, you can create another condition for severity equals to INFO (check the help above to create it correctly)
Success Condition
Subscription
The subscription is our listener. It will listen to the event triggered by the Job Scheduler in our case. We will assign our Conditions and our Actions to our subscription. So, when the Job Scheduler triggers an event with eventType JobSchedulerJobExecution and severity equals INFO, we will perform the configured action of sending an email.
Creating the subscription
Now we can select each condition that needs to be true to send our Alert notification for this subscription (listener).
For example, as one of our conditions is to receive only success events, then we will not trigger this listener in case of error events from the Job Scheduler
Setting Subscription Conditions
Finally, we can set the Action that is going to be performed when our Subscription (Listener) receives an alert/message that fulfills our conditions
Setting Subscription Actions
Testing our SAP Alert from the Job Scheduler
Now go to the Job Scheduler dashboard and schedule the execution of a job to test our subscription. Please, check if the Alert Notification flag for error or success is configured for this job first.
Scheduling the job execution
Now we can check the job execution log
Checking the job execution log
If you do not configure the subject, it will take the default showing the severity, category, and subject. But, if you set the subject as "Test", for example, it will be replaced by “Test”.
The same applies to the payload
Email Inbox
References
https://developers.sap.com/tutorials/alert-notification-service.html
https://help.sap.com/docs/ALERT_NOTIFICATION/5967a369d4b74f7a9c2b91f5df8e6ab6/8a7e092eebc74b3ea01d50...
https://help.sap.com/docs/alert-notification/sap-alert-notification-for-sap-btp/jobscheduler-job-exe...
https://help.sap.com/docs/ALERT_NOTIFICATION/5967a369d4b74f7a9c2b91f5df8e6ab6/35ca5de101fc4d5791cdbb...