+ Start a Discussion

Help bulkify this statement

i populate accTemp which is a Set<Account> with accounts that meet a certain criteria

trigger CaseTrigger on Case (after insert, after update)
Set<Account> accTemp=new Set<Account>();
List<Account> accTemp2 = new List<Account>();
// code to populate accTemp set with Accounts........

 for(Account a : accTemp){
            cases = [select id, accountid from Case WHERE accountid=:a.id AND isclosed!=true and createdDate >: System.Today()-365 LIMIT 90];
            a.Nuber_Of_Open_Cases__c = cases.size();


please help as i'm getting too many SOQL queries error when i do bulk upload.