function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GhilliGhilli 

List can accomadate 1000 records

Hi Friends,

 

I have written a trigger to update the "Total case attached(custom field on account)" to particular account.

Its working fine.

 

But for the existing accounts its not getting reflected.

So i have return one class to call from the Systemlog, so that it will go and update the account field.

 

But its saying like size exceed:1134 records. It seems like list can accomadate 1000 records.

Kindly give me a solution.

 

public class UpdateexistingAccountCaseRollup{ public static void updateAccountCases(){ List<Account> a = [select Id,of_cases_attached__c, service_location__c, (select Id from cases) from account]; List<Account> acc2=new List<account>(); for(Account acc : a) { List<Case> cases = acc.cases; acc.of_cases_attached__c = cases.size(); System.debug('***'+cases.size()); acc2.add(acc); } update acc2; } }

 

 

Thanks,

Ghilli.

aalbertaalbert

It is a governor limit as listed here.

 

Could you refactor this to be Batch Apex