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
ECoronaECorona 

Account Account Too many SOQL queries: 101

Hello I will really appreciate your help, i have this trigger, the coverage is 100% , but i get an error, System.LimitException: Too many SOQL queries: 101, Line 12 "List<Proveedores__c > media = [select id,name, Tipo_de_Proveedor__c,Fecha_de_Vencimiento_de_Contrato__c ,Proveedores__c, cuenta__c from Proveedores__c where cuenta__c in : conIds];" i don't know what else i can do. Thank you!


trigger ResumenProveedores on Account (before insert, before update) {



List<Id> conIds = new List<Id>();
String Proveedores='';

for(Account c : Trigger.new){
conIds.add(c.Id);
}

  List<Proveedores__c > media = [select id,name, Tipo_de_Proveedor__c,Fecha_de_Vencimiento_de_Contrato__c ,Proveedores__c, cuenta__c from Proveedores__c where cuenta__c in : conIds];

 for(Account c : trigger.new){
//      conIds.add(c.Id);
    
        
        for(Proveedores__c pro: media){
            Proveedores=Proveedores+': '+pro.tipo_de_proveedor__c+': '+pro.Proveedores__c+': '+pro.Fecha_de_Vencimiento_de_Contrato__c +'/' ;
            }
            c.Proveedores_Resumen__c= Proveedores;
     } 
}
Amit Chaudhary 8Amit Chaudhary 8
This Trigger is look good. Please check you have any other any other Trigger on Account object where you have issue
1) DML inside the for loop
2) SOQL inside the for loop.

Above issue used to come if you are adding SOQL inside the for loop.
ECoronaECorona
Thank you Amit! let me check, i have another trigger that works as this and i'll let you know what is going on
Amit Chaudhary 8Amit Chaudhary 8
Please add debug log and check where to many SOQL is executing in your code.
ECoronaECorona
can you explain me how can i get the log?
v varaprasadv varaprasad
Hi Ecorna,

Please add below extension and check how many soql excutes.

SOQL Extractor & Analyzer – A Google Chrome Extension for Salesforce.


Thanks
Varaprasad
ECoronaECorona
Varaprasad! thank you for your response, i installed the extension but how does ti works? it keeps gray and look it not working.
v varaprasadv varaprasad
Hi Ecorna

Please open debug logs and click on Extension icon.
Check once below link:
https://chrome.google.com/webstore/detail/soql-extractor-and-analyz/deihalhihjdilndoidoclmhmgllebkfj

Thanks
Varaprasad
ECoronaECorona
Hello Varaprasad! i have done that, but i don't know if it is not working, I open logs, etc but the icon don't show anything ... the pop up is not launched and it keeps on gray :(