You need to sign in to do that
Don't have an account?
Ajitkumar Pradhan 9
Batch not executing
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts
{
public String query;
global Database.querylocator start(Database.BatchableContext BC){
query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName ='\Lost\'';
return Database.getQueryLocator(query);
}
global void start(){
Database.executeBatch(new BatchJobStatus(),100);
}
global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
for (Opportunity opp : oppList) {
if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
}try{
update oppList;
}
catch(Exception e) {
System.debug(e);
}
}
}
global void finish(Database.BatchableContext bc){
// execute any post-processing operations
}
}
Code is not working. The opportunity satge is not getting updated.
{
public String query;
global Database.querylocator start(Database.BatchableContext BC){
query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName ='\Lost\'';
return Database.getQueryLocator(query);
}
global void start(){
Database.executeBatch(new BatchJobStatus(),100);
}
global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
for (Opportunity opp : oppList) {
if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
}try{
update oppList;
}
catch(Exception e) {
System.debug(e);
}
}
}
global void finish(Database.BatchableContext bc){
// execute any post-processing operations
}
}
Code is not working. The opportunity satge is not getting updated.
Regards,
Ramakant
Still not working.
Execute below code.
Database.executeBatch(new BatchJobStatus(),100);
Let us know the result