You need to sign in to do that
Don't have an account?

Schedule Query
Schedule QueryCan anyone help me out to solve this Error i would be very thankful for that.
1) When i schedule my schedule class from apex schedule , I am getting this error
-An error has occurred in the following section: [Exception, InvalidScheduledApexClass]. Salesforce.com has been notified of this error
1) When i schedule my schedule class from apex schedule , I am getting this error
-An error has occurred in the following section: [Exception, InvalidScheduledApexClass]. Salesforce.com has been notified of this error
http://blog.jeffdouglas.com/2013/01/17/schedule-apex-exception-no-apex-classes-found/
http://forcemonkey.blogspot.in/2010/01/what-causes-invalid-apex-classes.html
Let me know if it does not work.
public List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
public List<String> sendTo = new List<String>();
global void execute (SchedulableContext SC){
for(account acc : [SELECT id, Contact_Bill_Due_Date__c, Testing_Checkbox__c, (Select Id, SARA_Contact_Category__c ,Email FROM contacts) from account WHERE Contact_Bill_Due_Date__c =: date.TODAY()-5 OR Contact_Bill_Due_Date__c =: date.today()+1]){
for(contact con : acc.contacts) {
if(acc.Testing_Checkbox__c == true){
if(con.SARA_Contact_Category__c == 'Primary Institution contact' && con.SARA_Contact_Category__c == 'Billing rep'){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// Step 2: Set list of people who should get the email
sendTo.add(con.Email);
mail.setToAddresses(sendTo);
// Step 3: Set who the email is sent from
mail.setReplyTo('sirdavid@bankofnigeria.com');
mail.setSenderDisplayName('Salesforce');
// (Optional) Set list of people who should be CC'ed
//List<String> ccTo = new List<String>();
//ccTo.add('business@bankofnigeria.com');
//mail.setCcAddresses(ccTo);
// Step 4. Set email contents - you can use variables!
mail.setSubject('Expired Date');
String body = 'Dear ' + con.FirstName + ', ';
body += 'Due Date is Expired Now.';
body += 'Please Check That.';
mail.setHtmlBody(body);
// Step 5. Add your email to the master list
mails.add(mail);
mails.clear();
}
}
}
}
Messaging.sendEmail(mails);
}
}