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
Daniel GageDaniel Gage 

SFSSDupeCatcher:Too many SOQL queries: 101

Okay, I've been going crazy with the Governor limits on the queries for SF. I'm not a Salesforce Developer (I'm a C# Developer for Microsoft Dynamics) and this is really getting on my nerves, as I have no idea what is wrong. I have no SOQL queries within the loops, and the LeadConvert is the one that is causing the problems, and it doesn't even have an SOQL query in it.


I have a series of 2 triggers in order to accomplish the following:
1. First trigger goes through and matches the lead against a custom entity, marks it as verified(if there is a match) and updates another field with data from the Custom Entity. - this works, and seems to work on the mass upload. UNLESS -
2. Second Trigger does the Auto Lead Convert to Contact when the Verified field is marked. . Which works just fine individually. But not on a bulk import. When it is used on a Bulk import (in addition to the First trigger). It gives me the Too many SOQL Queries, and the error is popping up on the Second Trigger. Which seems strange, because there is no SOQL query on that trigger.





Here are the two triggers.Trigger 1.
trigger UpdateVerified on Lead (before insert) {
    List<String> leadEmails = new List<String>();
    Map<String, Member_Verification__c > MVMap = new  Map<String, Member_Verification__c >();

    for(Lead lead:Trigger.new){
        leadEmails.add(lead.Email);
        leadEmails.add(lead.Verification__c);
        leadEmails.add(lead.Verification1__c);
        leadEmails.add(lead.Verification2__c);
        leadEmails.add(lead.Verification3__c);
    }
    for(Member_Verification__c member :[SELECT Id, Primary_Email__c, Verification__c, Verification1__c, Verification2__c, Verification3__c,TFA_Salesforce_ID__C FROM Member_Verification__c
                                        WHERE (Primary_Email__c != null and Primary_Email__c IN :leadEmails) or (Verification__c IN :leadEmails)
                                       or (Verification1__c IN :leadEmails) or (Verification2__c IN :leadEmails) or (Verification3__c IN :leadEmails)]
       
       ){
        MVmap.put(member.Primary_Email__c , member);
           MVmap.put(member.Verification__c , member);
           MVmap.put(member.Verification1__c , member);
           MVmap.put(member.Verification2__c , member);
           MVmap.put(member.Verification3__c , member);
       
    }
    
    for(Lead leadObj:Trigger.new){
        if(MVmap.ContainsKey(leadObj.Email) || MVmap.ContainsKey(leadObj.Verification__c) || MVmap.ContainsKey(leadObj.Verification1__c) || MVmap.ContainsKey(leadObj.Verification2__c) || MVmap.ContainsKey(leadObj.Verification3__c)){
           
            If (MVmap.get(leadObj.Email) != Null){
                leadObj.TFA_Salesforce_ID__c = MVmap.get(leadObj.Email).TFA_Salesforce_ID__C ;}
           If (MVmap.get(leadObj.Verification__c) != Null){
                leadObj.TFA_Salesforce_ID__c = MVmap.get(leadObj.Verification__c).TFA_Salesforce_ID__C ;}
           If (MVmap.get(leadObj.Verification1__c) != Null){
                leadObj.TFA_Salesforce_ID__c = MVmap.get(leadObj.Verification1__c).TFA_Salesforce_ID__C ;}
            If (MVmap.get(leadObj.Verification2__c) != Null){
                leadObj.TFA_Salesforce_ID__c = MVmap.get(leadObj.Verification2__c).TFA_Salesforce_ID__C ;}
           If (MVmap.get(leadObj.Verification3__c) != Null){
                leadObj.TFA_Salesforce_ID__c = MVmap.get(leadObj.Verification3__c).TFA_Salesforce_ID__C ;}
            
            LeadObj.Verified__c = True;
        }

        }
}

Trigger 2. The LeadConvert Trigger
trigger LeadConvertVerified on Lead (after Update) {
 
 
string convertStatus = 'Closed - Converted';
    
List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();


for (Lead lead: Trigger.new) {
    
   if (!lead.isConverted && lead.Verified__c == True){
            
    Database.LeadConvert lc = new Database.LeadConvert();
    
    lc.setLeadId(lead.Id);
    lc.setAccountId(lead.Organization__c);
    lc.setDoNotCreateOpportunity(TRUE);
    lc.ConvertedStatus= convertStatus;
    
    leadConverts.add(lc);

        }
    }
        
if (!leadConverts.isEmpty()) {
List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
}

        
}

Now - I am getting the following information from the e-mail. Is it possible that the problem is actually with the SFSSSDupeCatcher? And if so, how would I get around that?

18:31:44.332|CUMULATIVE_LIMIT_USAGE_END

18:31:46.205 (49205858164)|CODE_UNIT_FINISHED|LeadConvertVerified on Lead trigger event AfterUpdate for [00QL0000004bMfL]
18:31:46.206 (49206269372)|ENTERING_MANAGED_PKG|CloudingoAgent
18:31:46.206 (49206338391)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
18:31:46.206 (49206346194)|VARIABLE_SCOPE_BEGIN|[1]|this|CloudingoAgent.LeadUpdatePOSyncTrigger|true|false
18:31:46.209 (49209390280)|VARIABLE_ASSIGNMENT|[1]|this|{}|0x32c3a985
18:31:46.212 (49212962345)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
18:31:46.213 (49213031885)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
18:31:46.213 (49213041109)|VARIABLE_SCOPE_BEGIN|[1]|this|SFSSDupeCatcher.SSDupeCatcherLeadTrigger|true|false
18:31:46.217 (49217282692)|VARIABLE_ASSIGNMENT|[1]|this|{}|0x4bae74cc
18:31:46.221 (49221178557)|SOQL_EXECUTE_BEGIN|[594]|Aggregations:0|select Id, SFSSDupeCatcher__Lead__c from Potential_Duplicate__c where Lead__r.Id IN :tmpVar1
18:31:46.228 (49228156565)|FATAL_ERROR|System.LimitException: SFSSDupeCatcher:Too many SOQL queries: 101

(SFSSDupeCatcher)
Best Answer chosen by Daniel Gage
Hargobind_SinghHargobind_Singh

Hi Daniel,
It seems like the error is not from your code, but coming from managed package "SFSSDupeCatcher", you should try to contact the app developer to see if you can find a solution. 

 

All Answers

Hargobind_SinghHargobind_Singh

Hi Daniel,
It seems like the error is not from your code, but coming from managed package "SFSSDupeCatcher", you should try to contact the app developer to see if you can find a solution. 

 

This was selected as the best answer
Daniel GageDaniel Gage

That's what I thought (After a week of banging my head against it, I finally came to that conclusion. But I am very thankful for the confirmation. This allows me to come up with an alternate work around for the client , and letting them know where the true problem lies. (this client actually has an ODC SQL connection set up, and by updating the record via the ODBC, it fires the trigger off as if it was just one record at a time, and I can work around the governer. But I only wanted to do that if I absolutely had to. )
 

Thanks again for the quick confirmation.