Purpose:Automatically notify specified recipients when a scheduled event (SE) fails, with the error details included.
Implementation Plan:
1. Create a Scheduler Email Settings Entity
plaintext
CopyEdit
Entity: SchedulerEmailSetting Attributes: - SchedulerName (String) - RecipientEmail (String) - IsActive (Boolean)
Optional: Add fields like CC
, Threshold
, Environment
if needed.
2. Wrap Scheduler Logic with Error Handling
Use a try-catch structure in the microflow.
On exception, capture the error message and call a Send Error Email sub-microflow.
plaintext
CopyEdit
Try → Main Scheduler Logic Catch → Log error + Call SendEmailOnFailure(SchedulerName, $latestError)
3. Send Error Email Sub-Microflow
Look up SchedulerEmailSetting
by SchedulerName.
If IsActive = true
, send an email with:
Scheduler name
Timestamp
Error message
Optional: stack trace, last successful run, link to logs
4. Admin Page to Manage Emails
Allow admin users to:
Add/edit email recipients per scheduler
Activate/deactivate notifications
Test the alert system manually
Sample Email Content
vbnet
CopyEdit
Subject: ❌ Scheduler Failed - [SchedulerName] Hi, The scheduled event "[SchedulerName]" failed at [Timestamp]. Error Message: [LatestError] Please review the application logs for more details. Regards, Mendix System Bot
Benefits:
Faster issue response time.
No need to babysit the logs.
Makes SE monitoring more robust and hands-off.