You need to sign in to do that
Don't have an account?
Rst123
Too many SOQL queries: 101
I'm facing issue :- Need help in fixing it.
Highlighted the line i'm getting Too many SOQL queries: 101
if(trigger.isAfter){
if(caids.size()>0){
Set<Id> RelCreditApprovalId= new Set<Id>();
for(credit_approval__c ca:trigger.new){
if(caids.contains(ca.id)){
if(ca.Credit_Line_Id__c!=null){
system.debug('Credit Line Id (LOC): '+ca.Credit_Line_Id__c);
RelCreditApprovalId.add(ca.Credit_Line_Id__c);
}
}
}
List<Credit_Approval__c> RelCreditApprovalList= [select Id,Application_Type__c,Credit_Line_ID__c,Submittal_Status__c,Approved_Amount__c,Approved_Amount_With_Tolerance__c,LOC_Adjustment_Amount__c, Risk_Decision__c,Amount_Approved_Remaining__c,
Credit_Line_ID__r.Submittal_Status__c,Credit_Line_ID__r.Approved_Amount__c,Credit_Line_ID__r.Approved_Amount_With_Tolerance__c,Credit_Line_ID__r.Risk_Decision__c,Opportunity__c
from Credit_Approval__c where Id in :RelCreditApprovalId];
if(RelCreditApprovalList!=null && RelCreditApprovalList.size()>0){
try{
update RelCreditApprovalList;
}catch(DMLException e){
system.debug('/nDML Exception : '+e.getmessage());
}
}
}
}
Highlighted the line i'm getting Too many SOQL queries: 101
if(trigger.isAfter){
if(caids.size()>0){
Set<Id> RelCreditApprovalId= new Set<Id>();
for(credit_approval__c ca:trigger.new){
if(caids.contains(ca.id)){
if(ca.Credit_Line_Id__c!=null){
system.debug('Credit Line Id (LOC): '+ca.Credit_Line_Id__c);
RelCreditApprovalId.add(ca.Credit_Line_Id__c);
}
}
}
List<Credit_Approval__c> RelCreditApprovalList= [select Id,Application_Type__c,Credit_Line_ID__c,Submittal_Status__c,Approved_Amount__c,Approved_Amount_With_Tolerance__c,LOC_Adjustment_Amount__c, Risk_Decision__c,Amount_Approved_Remaining__c,
Credit_Line_ID__r.Submittal_Status__c,Credit_Line_ID__r.Approved_Amount__c,Credit_Line_ID__r.Approved_Amount_With_Tolerance__c,Credit_Line_ID__r.Risk_Decision__c,Opportunity__c
from Credit_Approval__c where Id in :RelCreditApprovalId];
if(RelCreditApprovalList!=null && RelCreditApprovalList.size()>0){
try{
update RelCreditApprovalList;
}catch(DMLException e){
system.debug('/nDML Exception : '+e.getmessage());
}
}
}
}
Set up a debug log and try to see how many times this trigger is being called with a single DML statement triggering it.