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
Stephanie Holt 2Stephanie Holt 2 

How to debug "Too Many SOQL Queries: 101" when it is NOT in-house built Apex

Hi everyone, 

I have multiple simple Process Builders that are failing (sometimes). The error in the emails says:
 
Error element myRule_1_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: Too many SOQL queries: 101. For details, see API Exceptions.

I originally thought that it could be caused by one of 2 Apex Triggers, or 3 Classes that were built by a contractor before I started at the company. I have de-activated and commented out the triggers, and commented out the Classes, because the function they performed is less important than these processes builders working correctly.  The errors are still happening with my Process Builder processes. This leads me to believe it may be Apex from a managed package?

We have many managed packages. I found an article that we could get debug logs enabled for the managed package with their permission, but does anyone have any suggestion on how I could pinpoint which one may be the problem? Or do I need to contact every managed package provider and have them submit a case on my behalf to enable the logs? (That is what SFDC support told me to have them do). 

Second, even if those logs are enabled, I don't know if I'll be able to figure out the debug logs on my own. I have only done the "Developer Console Basics" trailhead module. Any suggestions/ help would be appreciated. 
Stephanie Holt 2Stephanie Holt 2
Here's the error email body and the most recent process that failed: 

Error element myRule_1_A2 (FlowRecordUpdate).
This error occurred when the flow tried to update records: Too many SOQL queries: 101. For details, see API Exceptions.

This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.

Flow Details
Flow Name: Copy_Recent_Source_Data_to_Original_if_Blank
Type: Record Change Process
Version: 8
Status: Active

Flow Interview Details
Interview Label: 
Current User: Salesforce Integrations (00541000000bGka)
Start time: 4/18/2018 10:23 AM
Duration: 0 seconds

How the Interview Started
Salesforce Integrations (00541000000bGka) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = 00Q4100000ol986EAA
myVariable_current = 00Q4100000ol986EAA

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "4/18/2018 10:23 AM"

DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!formula_myRule_1} (true) Equals true
Logic: All conditions must be true (AND)

DECISION: myRule_1_pmetdec

RECORD UPDATE: myRule_1_A1
Find all Lead records where:
Id Equals {!myVariable_current.Id} (00Q4100000ol986EAA)
Original_MQL_Date__c Is null true
Recent_MQL_Date__c Is null false
Update the records’ field values.
Original_MQL_Date__c = {!myVariable_current.Recent_MQL_Date__c} (null)
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_1_A2
Find all Lead records where:
LeadSource Is null true
Id Equals {!myVariable_current.Id} (00Q4100000ol986EAA)
Recent_Lead_Source__c Is null false
HubSpot_Original_Source__c Is null true
Update the records’ field values.
LeadSource = {!myVariable_current.Recent_Lead_Source__c} (Trade Show)
Result
Failed to update records that meet the filter criteria.

Error Occurred: Too many SOQL queries: 101
_______________________________________________________________________

Process Starts: Lead is created or edited

Criteria: Formula evaluates to true 
OR(
ISCHANGED([Lead].Recent_MQL_Date__c ),
ISCHANGED([Lead].Recent_Lead_Source__c  ),
ISCHANGED([Lead].Recent_Lead_Source_Detail__c  ),
ISCHANGED([Lead].Recent_Lead_Action__c ),
ISCHANGED([Lead].HubSpot_Original_Source__c  )
)
Do you want to execute the actions only when specified changes are made to the record? YES

Actions: All are "Update Records", all on the Lead the started the Process. This is done for 5 different fields, all with this same type of logic: 

Process Builder
 
Jack Yu@TokyoJack Yu@Tokyo
Hi  Stephanie Holt 2

you can refer below link for the same.
https://developer.salesforce.com/forums/?id=9060G000000BiK2QAK
https://success.salesforce.com/issues_view?id=a1p3A0000001C7cQAE
Waqar Hussain SFWaqar Hussain SF
I had the same issue, unfortunately I did not get any solution for the same issue. I had to convert my Process builder to apex trigger which solved my issue. Actually it is very hard to know that what is causing the error.

It seems known issue with Salesforce. May be you will have to convert your Process builder to apex trigger to avoid this issue.
https://success.salesforce.com/issues_view?id=a1p3A0000001C7cQAE

 
Stephanie Holt 2Stephanie Holt 2
OK, thank you both for your replies. I am a solo admin, and have been planning to start learning development/apex with Apex Academy and Trailhead. This would definitly be above my skillset currently, but now I have a new goal with some immediate urgency!