You need to sign in to do that
Don't have an account?
Susan Love 2
batch processes
We have fields on our Account page which total number of meetings via the Contract page. This is run through scheduled batches. Unfortunately we noticed the Apex code was incorrect as one of the totals was wrong. I have corrected the code but the existing totals that were there have not changed. Would I need to put all the totals in as 0 then let the batches run to enable the correct totals to appear?
As per my understanding you can implement logicin in execute(scope) method of batch apex as
for(Account record : (List<Accont>)scope){
record.totalNumberofMeetings = 0;
}
//Your code
Update scope;
Can you implement your logic this way or share you code so I can help you.
Regards,
Prakash
If your batch is processing all the records irrespective of any where condition then it should update all the totals correctly. It would be good if you can share your batch code.
Thanks,
Abhishek Bansal.
global class ScoreCardSchedule implements Schedulable {
global void execute(SchedulableContext SC) {
// Update the accounts with score card data
ScoreCardBatch scb01 = new ScoreCardBatch();
scb01.type = 'UpdateAccountsWithContractData';
database.executebatch(scb01,100);
// Update the RM users (owners) with score card data
ScoreCardBatch scb02 = new ScoreCardBatch();
scb02.type = 'UpdateRmUserAccountsWithContractData';
database.executebatch(scb02,100);
We need to see the query that returns the records to be updated. If there is anything urgent on this then you can contact me on Gmail or Skype.
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Thanks,
Abhishek Bansal.