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
Wendy Schott 1Wendy Schott 1 

Recurly Subscription changes: Process Builder: Too many SOQL queries: 201 - But record is updated

I have used Process Builder quite a bit in the past, however, this problem has stumped me.

I have a process that when a subscription record is changed, depending on which fields changed will push values from the subscription to the account record.  

The subscription records are controlled and updated by Recurly ( our billing system).  They have a batch job that runs every 5 minutes and pushes changes to SFDC.  When a subscription changes, I use Process Builder to update the Account with the changed information.    

I keep getting the following:  Error Occurred: recurly_v2:Too many SOQL queries: 201
In fact, the email I get will reference about 45 records.  

What is odd is following:
I received the email with the failure at 2:49 pm on 2/27/2016

The email failure reports record: ACCOUNT:  0010a00001MWEBt
That account record was last modified at 2/27/2018 4:29 AM
The subscription record that could have triggered this was last modified at 2/27/2018 4:43 AM

When I looked at the users record in Recurly there were no changes to that record at all?  
When I try to dig through the Debug Logs I can not find any references to this WF at all?

Any help would be greatly appreciated.
 

User-added image


 



 

Maharajan CMaharajan C
Hi Wendy,

Check your batch class.

Is there any soql inside the for loop.

like below:

for (User u : usrRecords)
{
if(System.now() > u.LastLoginDate.addDays(60))
 {
for (Account a : [Select Id,ownerId from Account where ownerId =:u.Id LIMIT 1]){

if you have like that or any SOQL inside the Loop  then try to avoid this loop.

Or post your  Batch class

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!


Thanks,
Raj
 
Dev_AryaDev_Arya
HI Wendy,

first of all, when we recieve the limit exceptions, the line number or the record mentioned in the logs is not the record which caused the error. Infact that record was never processed, but the limit exception happened the moment system touched the record. Hence the records prior to the record mentioned in the mail are most probably the reason for the limit. That being said, you would need to analyse the logs regarding where it mentions the count and if there are any queries in the loop.
follow up question:
1. If the system was working fine before and recently started causing this error, then was there any change made to the account trigger or any other related object?
2. If possible could you share the logs, that may help to further analyse.

Cheers,
Dev 
Wendy Schott 1Wendy Schott 1
Thank you both for your quick responses.  I ended up breaking the 1 process into 3 separate process and things are now working as expected. 
Dev_AryaDev_Arya
Hi Wendy,
Glad that solved the issue, but I think the root cause is still missing, which part of the process actually triggered the error at the first point. 
I would really advise to dig a bit deeper and find it out, but again its up to you. :-)

Cheers,
Dev
 
Wendy Schott 1Wendy Schott 1
Ok I could use some additional help.  Currently, Recurly syncs to SFDC every 5 minutes.  I created a single Process builder Action that looks for all new and updated subscriptions and simply moves values from the Subscription to the Account Record.  There are ~ 10 fields mapped 1:1.  This is the only process builder flow active.    

It keeps failing with Error element myRule_1_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: recurly_v2:Too many SOQL queries: 201 . 

I am unsure how to debug this one.  I have a feeling this is due to the bulk update done by Recurly but not sure how to solve.  Open to a consultant helping on this one.

Thanks
Wendy