ScheduledNotificationService workflow rule

This workflow rule (WFR) looks at each task / event (activity_log record) referenced in the notifications table, and tests the dates and status against the trigger conditions in the corresponding notification template (also referenced in the notifications table). When the trigger conditions are met for a task/event, the workflow rule (WFR) sends an email to each recipient using the email parameters (email subject, body, and recipients) defined in the notification template.

By default, the WFR runs daily at 12:00 AM local time. You can customize the schedule in the afm_wf_rules table. For metrics, the workflow rule that sends the notifications will run on a daily basis after the metrics collection workflow rule.

For each metric trend value generated today (metric_date) where afm_metric_trend_values.metric_name exists in afm_metric_notify, the system tests the value against the trigger conditions defined in the metric’s template (afm_metric_notify.template_id). If the trigger conditions are met, the system inserts a record in notifications table (afm_metric_trend_values.auto_number, afm_metric_notify.template_id).

The WFR uses the standard MailSender API to send the emails. It sends a separate email message to each recipient defined in a notification template. MailSender logs all successful or failed email transmission attempts to the existing afm_notifications_log table. Make sure to check this table if you are not receiving emails from the WFR as expected.

The WFR uses the standard FreeMarker API ( http://freemarker.sourceforge.net/docs/index.html ) to process the email subject and body strings referenced by the notification template in the messages table.

Viewing the Module and source record for a notification

In order to show an audit trail for sent messages from different applications, the system associates afm_notifications_log records with the module and source record that triggered the email. The source_name (name of the module), and source_id (source-specific identifier, such as a Primary Key) in the afm_notifications_log table, provide this information. In this way, the system can track the specific metric and application for which the notification was sent.

The WFR creates a notifications record only for alerts that are actually triggered: