I'm want to update all Closed Won Opportunities Every Month and this is my batch apex class the problem here is it's not entering if loop but I guess if loop is proper. I'm unable to rectify where the bug is.
global class UpdateOpportunity implements Database.Batchable<sObject>{
string query;
global Database.querylocator start(Database.BatchableContext BC){
Query = 'Select id, name, Amount__c, Man_Power_Amount__c,Stage__c From Opportunity__c';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Opportunity__c> scope1){
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+scope1);
for(Opportunity__c p : Scope1){
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+p.stage__c);
if(p.stage__c == 'Closed Won')
{
p.Man_Power_Amount__c = 000;
}
update p;
}
}
global void finish(Database.BatchableContext BC){
}
}
Rather i guess it's not at all executing "Execute Method" Kindly help on this.