You need to sign in to do that
Don't have an account?

System.LimitException: Too many SOQL queries: 101
Hi There,
I am getting error when trying to deploy code from sandbox to production.
The code is working fine in sandbox and I am lost for thoughts on how to fix this.
I am posting the classes, the code that are causing the error and the error log.
Please help me.
trigger CloseCase on pb__Agreement__c (before update) {
//List<ID> accIds = New List<ID>();
List<ID> agIds =New List<ID> ();
for(pb__Agreement__c ag:Trigger.new){
if(ag.pb__AgreementType__c == 'Sale' && ag.Stage__c == 'Transaction Closed and Commission Received'){
agIds.add(ag.Id);
}
}
List<Case> c = [ SELECT id,Agreement__c,Status, RecordTypeId from Case where Agreement__c = :agIds and RecordTypeId = '012A0000000h1l4' LIMIT 2];
if(c.size() > 0){
Case cs = c[0];
c[0].Status = 'Closed';
}
update c;
}
Hi,
Can you post the test method that you use and the error messages as well?
// Niklas
My bad. Sorry I forgot to do that.
The error is on the closecase trigger I posted before on Line 9 Column 1
UnitTestsCreatePaymentTrigger.myUnitTest System.LimitException: Too many SOQL queries: 101
UnitTestsTenantVacatingProperty.myUnitTest System.LimitException: Too many SOQL queries: 101
23.0
The 2 test classes referred in the error -
UnitTestsCreatePaymentTrigger
UnitTestsTenantVacatingProperty