We have a couple of jobs that are scheduled daily.
Is there any way, we can select options in the management console such that if the jobs fail, a notice is sent to the mail addresses.
I could do it for the scheduled reports in BO CMC.
In the job you want to monitor put a TRY transform before the first workflow and put a CATCH transform after the last workflow (or place them across which workflows ever you want to monitor). In the catch, set it to catch all exceptions (or whatever you want to catch).
Within the flow area of the catch, add a workflow or dataflow and within this add a script that contains the smtp_to() function. You will need to configure your DI server to be able to send smtp mail server with this method (should be information available in the supporting doucmentation or on this site). You can use other DI functions to include additional information in the email too.
If you want to toggle whether these are emails are generated from the management console this requires something extra again!
Add a new variable to the original job (e.g. called āEMAIL_FLAGā)
Have this variable set by retrieving the value of a flag held in a database table (e.g. table name āBODI_VARIABLESā)
In the original job, alter the CATCH email script to only send an email if this flag is True.
Create a two new jobs that will either set or unset this EMAIL_FLAG.
You can then run this new job from the management console in order to email (or not) if the original job fails.
Alternatively, create the job variable (āEMAIL FLAGā), alter the email script to use this flag and when scheduling the job in the management console, create two identical schedules except for one the value is manually set to TRUE (or 1) and the other FALSE (or 0). Active and deactivate as required.
I have added the try-catch blocks and smtp_to function in my job. But as Darth said, my admin has to do the necessary configurations in the Job server for it to send mails.
Being implemented the mail functionality using mail_to function, I am able to send mails when the job fails.
But the only concern is, the admin console is displaying the jobās status in Green color when it fails. Usually without having the try catch blocks, if the job fail, the status will be displayed in red cross.
But here i am not getting like that. Should I change some setting such that even when i use the try catch blocks, the jobās status goes to red color when it fails?