Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. global void finish(Database.BatchableContext BC){
  2.         System.debug('==== In finish start 2====');
  3.         try{
  4.             System.debug('==== In finish start ====');
  5.             try{
  6.                 EmailHelper.sendEmails(emailList);
  7.             }catch(Exception e){
  8.                 System.debug(e.getStackTraceString());
  9.                 exceptionList.add(e);
  10.             } finally {
  11.                 if(!exceptionList.isEmpty()){
  12.                     System.debug('==== In finish ====');
  13.                     Messaging.SingleEmailMessage msg = EmailHelper.createEmailWithExceptions(exceptionList, 'BatchRenewChargeForTomorrow', new String[] {Constants.CSOLUTOR_EMAIL});
  14.                     List<Messaging.SingleEmailMessage> msgList = new List<Messaging.SingleEmailMessage>();
  15.                     msgList.add(msg);
  16.                     EmailHelper.sendEmails(msgList);
  17.                 }
  18.             }
  19.         } catch (Exception e2){
  20.             System.debug(e2);
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement