You need to sign in to do that
Don't have an account?
imishra
Apex scheduler code
Hi
I want to send an email once in every 30 days when the lead rating field in Lead object is warm until it is changed to hot.
I am trying to write a apex scheduler class, can anybody please help me with this.
Its very urgent.
Thanks in advance.
Yes, Its look simple.
Hope, this will fulfill the requirement.
Sincerely,
Praful G.
Thanks for the quick reply.
M getting error like---
Error: Compile Error: sendMailToHotLeads: Class must implement the global interface method: Iterable<SOBJECT:Lead> start(Database.BatchableContext) from Database.Batchable<SOBJECT:Lead> at line 1 column 14
Can you please tell me how to solve this.
I was able to solve the error.
global class sendMailToHotLeads implements Database.Batchable<SObject>
instead of
global class sendMailToHotLeads implements Database.Batchable<Lead>
The error is solved but how to schedule it. When i click on the scheduleApex it shows only classes that implements schedulable but this implements database.batchable.
Please let me know is there any other way to schedule it.
Thanks.
Hi,
Please refer http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Here, see:
After that you can schedule the batch by system.schedule method from running this snippet in developer console as follow
Sincerely,
Wer should i write the query to select the warm leads here?
Here, while scheduling a batch no need to query Leads, as we have already done that in Batch class (Start Method).
'+ 'To view your lead click here.'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } } global void finish(Database.BatchableContext BC) { //Finish } } and thn i have called the batch class from scheduler as below: global class scheduledMerge implements Schedulable{ global void execute(SchedulableContext SC) { sendMailToHotLeads M = new sendMailToHotLeads(); } } Please let me know wat m i missing here.
If the above post is your solution, kindly mark this as the solution to the post so that others may benefit.
Regards,
Praful Gadge.