The trigger in question reassigns cases from the updated account to another account given a criteria defined by a single custom field in those cases.
Basically, if "Case.ReassignTo__c" has a value, i have to reassign that case to an Account that has the value of "Case.ReassignTo__c" in its "Field__c" field.
This is the trigger:
trigger ReassignCasesOnField on Account (after update) {
List<Case> caseList= new List<Case>();
for (Account a : Trigger.new) {
if (a.IsPersonAccount && a.Field__c != null){
Case[] casesToReassign = [select id from Case where ReassignToField__c =: Integer.valueOf(a.Field__c) and LastModifiedDate = TODAY];
for (Case ca : casesToReassign){
ca.AccountId = a.Id;
ca.ReassignTo__c = null;
caseList.add(ca);
}
}
}
update caseList;
}
I'm thinking the batch size of the DataLoader has something to do since I'm getting a
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:ReassignCasesOnField: System.LimitException: Too many SOQL queries: 101
but I guess that's a symptom and not the main issue.
I've tried to get the cases into a map, populating it inside the for loop and then updating the cases, to no avail, I get the same error in the SOQL.