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
Samir Mahtani 4Samir Mahtani 4 

Apex/ Governor Limit Issues

Hi! 

I recently opened a case with SF because we were getting all sorts of error emails about processes failing ( see below for 1 example). SF told me it was because data loaders batch size was 200 and needed to be changed to 1. These errors were popping up randomly and had only once been triggered by a data loader update, but I still made the change. After making the change, we are still getting errors and SF told us this:

" It is possible that the data loader has already reached the error handling since upon checking, you're updating or inserting a lot of records which reached its limit. Considering this situation, this requires a custom solution which involves handling the transaction via apex. This ensures that the records are committed within the exact timeframe and not hit the governor limit and this needs to be coordinated with your internal developer."

Does anyone know what I need to do? We do not have a developer. 

Error: 

Error element myRule_3_A1 (FlowRecordUpdate).
The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cbit.cbt_Accounts: System.LimitException: Apex CPU time limit exceeded. You can look up ExceptionCode values in the SOAP API Developer Guide.---The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cbit.cbt_Accounts: System.LimitException: Apex CPU time limit exceeded. You can look up ExceptionCode values in the SOAP API Developer Guide.

Flow Details
Flow API Name: Update_Number_of_Locations
Type: Record Change Process
Version: 2
Status: Active
Org: Review Trackers (00D50000000JW2O)

Flow Interview Details
Interview Label: Update_Number_of_Locations-2_InterviewLabel
Current User: SFZuora Integration (0051T000008Wt0x)
Start time: 4/21/2021 8:04 AM
Duration: 0 seconds

How the Interview Started
SFZuora Integration (0051T000008Wt0x) started the flow interview.
API Version for Running the Flow: 49
Some of this flow's variables were set when the interview started.
myVariable_old = Account (00138000018jfcjAAA)
myVariable_current = Account (00138000018jfcjAAA)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!myVariable_current.Available_Locations__c} (4) Equals 1

Default outcome executed.

DECISION: myDecision2
Outcome executed: myRule_3
Outcome conditions:
1. {!myVariable_current.Available_Locations__c} (4) Less than or equal 9
2. {!myVariable_current.Available_Locations__c} (4) Greater than or equal 2
Logic: All conditions must be true (AND)

UPDATE RECORDS: myRule_3_A1
Find all Account records where:
Id Equals {!myVariable_current.Id} (00138000018jfcjAAA)
Update the records’ field values.
Number_of_Locations__c = 2-9
Result
Failed to update records that meet the filter criteria.

Error Occurred: The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cbit.cbt_Accounts: System.LimitException: Apex CPU time limit exceeded. You can look up ExceptionCode values in the SOAP API Developer Guide.---The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cbit.cbt_Accounts: System.LimitException: Apex CPU time limit exceeded. You can look up ExceptionCode values in the SOAP API Developer Guide.

SwethaSwetha (Salesforce Developers) 
HI Samir,
Can you try the approach mentioned in https://salesforce.stackexchange.com/questions/265720/flow-error-apex-cpu-time-limit-exceeded and see if it helps.

If this information helps, please mark the answer as best. Thank you