• Orkhan Shukurov
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I have scheduled 2 apex jobs through Developer Console. The issue is when second job runs it also triggers the first job.

Any ideas why?
I need a scheduled apex job for field update. I have the following code but it doesn't work. Any ideas about what could be the problem?


global class ReportStatusNotification implements Schedulable {

   public void execute(SchedulableContext ctx)  {
    List<Project__c> projs = new List<Project__c>();

    for(Project__c p : [SELECT Last_Status_Report__c, Report_Status_Indicator__c FROM Project__c]){
      if (p.Last_Status_Report__c.month() == Date.Today().month()) {
        p.Report_Status_Indicator__c = 'Green';
      } else {
        p.Report_Status_Indicator__c = 'Red';
      }
      projs.add(p);
    }

    update projs;
}

ReportStatusNotification m = new ReportStatusNotification();
    String sch = '0 0 0 5-31 * ?';
    String jobID = system.schedule('ReportStatusNotification', sch, m);

}
I need a scheduled apex job for field update. I have the following code but it doesn't work. Any ideas about what could be the problem?


global class ReportStatusNotification implements Schedulable {

   public void execute(SchedulableContext ctx)  {
    List<Project__c> projs = new List<Project__c>();

    for(Project__c p : [SELECT Last_Status_Report__c, Report_Status_Indicator__c FROM Project__c]){
      if (p.Last_Status_Report__c.month() == Date.Today().month()) {
        p.Report_Status_Indicator__c = 'Green';
      } else {
        p.Report_Status_Indicator__c = 'Red';
      }
      projs.add(p);
    }

    update projs;
}

ReportStatusNotification m = new ReportStatusNotification();
    String sch = '0 0 0 5-31 * ?';
    String jobID = system.schedule('ReportStatusNotification', sch, m);

}