I'm trying to uncheck a checkbox on the opportunity object called Commitment
global class UpdateContacts implements Database.Batchable<sObject>
{
global Database.queryLocator start(Database.BatchableContext BC )
{
String str = 'SELECT Id, Commitment__c FROM Opportunity WHERE IsOpen = false';
return Database.getQueryLocator(str);
}
global void execute(Database.BatchableContext BC, List<Opportunity> opportunityToProcess)
{
List<Opportunity> opportunityList = new List<Opportunity>();
for(Opportunity oppObj : opportunityToProcess){
Commitment__c = true;
opportunityList.add(oppObj);
}
update opportunityList;
}
global void finish(Database.BatchableContext BC)
{
system.debug('finish');
}
}