• Blobo Mobo
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi, I want to call a nightly batch update process on all of the opportunities in the pipeline (certain criteria).

 

right now, I am logging in nightly and running a report and clicking all of the opportunities one at a time and clicking "edit" and then "save" and that's ridiculous. how do i automate this?

 

global class BatchUpdateForecast implements Database.Batchable<sObject>{

   global final String Query;
   global final String Entity;
   global final String Field;
   global final String Value;

   global BatchUpdateForecast (String q, String e, String f, String v){

      Query=q; Entity=e; Field=f;Value=v;
   }

   global Database.QueryLocator start(Database.BatchableContext BC){
      return Database.getQueryLocator(query);
   }

   global void execute(Database.BatchableContext BC, List<sObject> scope){
     //for(sobject s : scope){
     //s.put(Field,Value); 
     //}
     update scope;
    }

   global void finish(Database.BatchableContext BC){
   }
}

 

global class batchitupson_schedule implements Schedulable {
global void execute(SchedulableContext scMain) {
BatchUpdateForecast clsBatchItUpSon = new BatchUpdateForecast('Select Id, Name FROM Opportunity','Opportunity','Source_Name__c','Gwins');
ID idBatch = Database.executeBatch(clsBatchItUpSon, 100);
}
}

 

Hi All,

 

I am trying to abort a scheduled job using System.abort() method. I am using getTriggerId() to get the id of the scheduled job. The line gets executed without any errors and i ahve confirmed the same in debug logs. However the job is not getting aborted. This functionality was working a few days back, but currently stopped working it seems.

 

Can anyone provide any help on this????