Chargent Support Center


Apex CPU time limit exceeded

Apex CPU time limit exceeded

If you experience this error:

System.LimitException: Apex CPU time limit exceeded

related to one of Chargent's Triggers, here is how to troubleshoot.

Salesforce gives a 10 second time limit for every database transaction.  If the transaction can’t be completed in 10 seconds, Salesforce will halt everything and throw an error. If you are updating a batch chunk of 30 records with Chargent’s recurring billing batch, that is considered a single transaction.

All packages, custom code, etc. shares the same time limit so if your batch is processing transactions and you have custom code running at the same time, they will share this allotted time which could cause this error.

This type of error could be caused by a process in Process Builder, a custom Trigger, or custom Apex code. The code that throws the error is not necessarily the issue, it only shows what was running when the time limit was reached. Potential code issues that exceed the CPU Limit could be a loop in code so it never finishes, or a bunch of long running processes added together.

In order to better understand what's causing the issue you should do the following to obtain the CPU logs from Salesforce and provide them to Chargent support.
  1. Open a case with Salesforce support
     
  2. Request that debug logs are enabled for the Chargent namespaces
    • ChargentBase
    • ChargentOrders
       
  3. Setup logging for user who scheduled the batch for the timeframe in which the batch runs
    • Setup
    • Environments
    • Logs
    • Debug Logs
    • Set the logging level to finest for Apex and system.
       
  4. After the batch runs, send Chargent the logs.  Export / Save

If you have a version other than Chargent Orders installed email us to obtain the correct namespace.
 


Related Articles

996e33de7bae3639f2380ddcfaf383d7@chargent.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete