You need to sign in to do that
Don't have an account?
Simrin
I have a fucntion which checks if the date enetered is less than today. If true then it will update column__c to Done.
I want to implement it as apex scheduler.
I followed below links with no scucess.
http://stackoverflow.com/questions/9126886/how-do-we-schedule-a-class-to-run-every-15-mins-in-salesforce
https://developer.salesforce.com/forums?id=906F00000008rTLIAY
Apex Scheduler sample code not working
public void testSchedule() { List<Object_C> pList= [Select date__c FROM Object_C WHERE UserId = :UserInfo.getUserId() ]; for(Object_C test : pList) { if(test .date__c< Date.today()){ test .column__c = 'DONE'; update Object_C; } } }
I have a fucntion which checks if the date enetered is less than today. If true then it will update column__c to Done.
I want to implement it as apex scheduler.
I followed below links with no scucess.
http://stackoverflow.com/questions/9126886/how-do-we-schedule-a-class-to-run-every-15-mins-in-salesforce
https://developer.salesforce.com/forums?id=906F00000008rTLIAY
global class certifiedToLapsedScheduler implements Schedulable{ global void execute(SchedulableContext SC) { RecurringScheduleJob.startJob(); String day = string.valueOf(system.now().day()); String month = string.valueOf(system.now().month()); String hour = string.valueOf(system.now().hour()); String minute = string.valueOf(system.now().minute() + 10); String second = string.valueOf(system.now().second()); String year = string.valueOf(system.now().year()); String strJobName = 'Job-' + second + '_' + minute + '_' + hour + '_' + day + '_' + month + '_' + year; String strSchedule = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year; System.schedule(strJobName, strSchedule, new certifiedToLapsedScheduler()); } }
ERRRO: Method does not exist or incorrect signature: RecurringScheduleJob.startJob()
public class RecurringScheduleJob{ public static void startJob(){ String str = 'Job Started at : ' + system.now(); Schedule_job__c obj = new Schedule_job__c(); obj.name = str; insert obj; } }ERROR: Invalid type: Schedule_job__c
ERROR: Invalid type: Schedule_job__c
I think your org is not having custom object Schedule_job__c
2) use global for the below class.
global class RecurringScheduleJob{
Regards,
BDatla
All Answers
ERROR: Invalid type: Schedule_job__c
I think your org is not having custom object Schedule_job__c
2) use global for the below class.
global class RecurringScheduleJob{
Regards,
BDatla
I chage class to above.
I do not have any errors.
How can i run or start this class for first time. Presently i am in sandbox but i will need to make sure that the method i use here will alow be ok foor production environment
You can find more information in the below article.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
I belive you just need to execute that particular method in the execute anonymous section .
Regards,
BDatla
This Apex class has batch or future jobs pending or in progress; This schedulable class has jobs pending or in progress.
How can i edit my apex code