• Nitin Khandelwal 15
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi,
I have a batch apex:
global class BatchInitialJobControlRecord implements Database.Batchable<sObject>{
    
    global final string query;
    
    global BatchInitialJobControlRecord(){
        query = 'Select Id, processing_status__c, job_code__c From job_control__c where job_code__c = \'courseoffering1\'';		
    } 
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        
        return Database.getQueryLocator(query);
    }
    
    
    global void execute(Database.BatchableContext BC,List<sObject> scope) {
        List<Job_Control__c> updateObjs = new List<Job_Control__c>();
        
        for(Sobject s : scope) {
            Job_Control__c obj = (Job_Control__c) s;
            obj.processing_status__c = 'CRM Ready to Process';
            updateObjs.add(obj);
        }  
        update updateObjs;
    }
    
    
    global void finish(Database.BatchableContext BC) {
        system.debug('Batch Job to update processing status is complete!');
    }	
}

and a scheduled class for it:
global class ScheduleBacthInitialJobControlRecord implements Schedulable{


   global void execute(SchedulableContext ctx) {
      BatchInitialJobControlRecord p = new BatchInitialJobControlRecord();
        database.executeBatch(p,1);
   }   

	
}

I am running it in anonymous window 
System.schedule('Scheduled Job 1', '0 0 * * * ?', new ScheduleBacthInitialJobControlRecord ());
System.schedule('Scheduled Job 2', '0 5 * * * ?', new ScheduleBacthInitialJobControlRecord ());

but i want to make my query parametized which i should be able to pass through anonymous window.
Can anybody help me with a code snippet?

Thanks
Hi,
Can you please help me with a code snippet to populate the lookup of a record in via apex?
I have a record CRIC and other record Course. Both have the field test field having the same values.
IN the CRIC object i have a lookup field on course called course id.
In apex, i want to compare the test field values in CRIC and Course record and populate the course id field (lookup field). And it will be a list of records.
hi there, does any know how to get all failures at once in ant migration tool when deploying? it gives a subset of failures each time when you try to deploy.