You need to sign in to do that
Don't have an account?
ms Scott
Schedulable Apex class only running once from scheduler - scheduled to run every week, it runs once and won't repeat
I have a schedulable apex process that i use to update a date field and then update all of the records. The process works great, i use the scheduler and schedule it to run every week on Tuesday's at 10pm (for 2 months or longer). It fires on Tuesday, but won't fire the 2nd week or any other time. I tried every other day, every day, no matter how many time i schedule to process...it will only fire once. Is there's something i'm missing?
Here's my code;
global class SchedulerToUpdateDate implements Schedulable {
List<Grad_Employment_Detail__c> allRec = new List<Grad_Employment_Detail__c>();
List<Grad_Employment_Detail__c> toUpdate = new List<Grad_Employment_Detail__c>();
global void execute(SchedulableContext sc){
allRec = [select id, current_Date__c from Grad_Employment_Detail__c];
for(Grad_Employment_Detail__c ge: allRec){
ge.current_Date__c = date.today();
toUpdate.add(ge);
}
update toUpdate;
}
}
Thanks in Advance! (this is my first apex class)
M Scott
Here's my code;
global class SchedulerToUpdateDate implements Schedulable {
List<Grad_Employment_Detail__c> allRec = new List<Grad_Employment_Detail__c>();
List<Grad_Employment_Detail__c> toUpdate = new List<Grad_Employment_Detail__c>();
global void execute(SchedulableContext sc){
allRec = [select id, current_Date__c from Grad_Employment_Detail__c];
for(Grad_Employment_Detail__c ge: allRec){
ge.current_Date__c = date.today();
toUpdate.add(ge);
}
update toUpdate;
}
}
Thanks in Advance! (this is my first apex class)
M Scott
<pre>
global class SchedulerToUpdateDate implements Schedulable
{
global void execute(SchedulableContext sc)
{
List<Grad_Employment_Detail__c> allRec =
[select id, current_Date__c from Grad_Employment_Detail__c];
for ( Grad_Employment_Detail__c ge : allRec )
{
ge.current_Date__c = date.today();
}
update allRec;
}
}
</pre>
All Answers
<pre>
global class SchedulerToUpdateDate implements Schedulable
{
global void execute(SchedulableContext sc)
{
List<Grad_Employment_Detail__c> allRec =
[select id, current_Date__c from Grad_Employment_Detail__c];
for ( Grad_Employment_Detail__c ge : allRec )
{
ge.current_Date__c = date.today();
}
update allRec;
}
}
</pre>
Regards,
Pawan Kumar
Michael Scott