You need to sign in to do that
Don't have an account?
Saswat Mohanty
email notification on batch job failure
Hello,
Currently in our org there are many batch jobs which run and perform certain activities. Now the requirement is to notify the admin immediately via email when any of the batch jobs is failed . Though I know, there is a mail template which can be implemented in finish method of each batch job, however it is difficult to put in every batch jobs as it is time consuming.
Could you please help in getting a common class which will check what are the batch jobs that finish the run for a particular day(ideally every day) and then for failed jobs it will send immediate email notification?
Currently in our org there are many batch jobs which run and perform certain activities. Now the requirement is to notify the admin immediately via email when any of the batch jobs is failed . Though I know, there is a mail template which can be implemented in finish method of each batch job, however it is difficult to put in every batch jobs as it is time consuming.
Could you please help in getting a common class which will check what are the batch jobs that finish the run for a particular day(ideally every day) and then for failed jobs it will send immediate email notification?
To make your implementation simple, develop a utility class which will send email notification about the job detail and call that utility class in your finish method but yes you have to edit all batch class.
Thanks,
Karan
You can create a new batch class and add below code to it to get email notification for failed batches:
Below is the reference code. You can modify them as per your needs:
May be in a method I should extract job ids from Asyncapex job and then for failure ones only will send email?