Share all details about your problem, including any error messages you may have received.
We have many HRMS applications for which aggregation tasks run on scheduled basis.
The requirement is to get email notification whenever aggregation and refresh tasks fails but we dont want to use the inbuilt notification functionality for tasks.
We want to do it via runrule task, so can anyone help me with the coding part of it.
I don’t have a sample rule, but I can guide you with the logic or provide pointers based on how I’ve handled it in the past. I created a rule where I monitored a list of task definitions for failures or overruns. Using the task results, I checked their completion time and status, then built the logic to trigger an email notification accordingly.
I’ve built a plugin before that uses a service definition to check for certain task failures and if the last task status failed it sent an SMS message to the admins. It would just log that it notified them so it wouldn’t keep sending messages when the service ran every 90 seconds or so.
You can try below snippet to trigger mail notification. If you are able to filter out the failed task, then you can use below snippet to send notification.