Apex Timeout

Overview

Below is information on how to troubleshoot errors when hitting Salesforce's governor limits.

Error: Apex CPU time limit exceeded. An unexpected error has occurred. Your solution provider has been notified. (ApexPage).

Situation 1: I am having an issue posting a billing. Upon clicking the Post button, it will run for a while and throw the error.

Situation 2: We received the error when trying to batch pay/post 50 checks.

Background

An Apex Timeout Exception effectively means that too much Apex Code (or process builder flows or both) is attempting to execute and is exceeding the time limit allocated by Salesforce. Salesforce imposes a limit on the CPU usage that can be consumed in a given execution context, which is approximately 10 seconds. This article explains the concept in more detail. In a nutshell, too much processing is attempting to occur between our code and some other code and is taking too much time.

You might assume this is an Accounting Seed error because it says AcctSeed in the error message but this is not exactly the case. We have performed extensive stress tests on our app and ensured that our code adheres to best practices and is tuned for performance. In our tests, all our processes (i.e. posting a billing, closing an accounting period) use 1.2 seconds or less of CPU time. What is probably using up most of the CPU time is other Apex Code or Process Builder flows.

This limit is enforced on all code involved in a certain execution without regard to whether the code exists in:

Accounting Seed Financial Suite’s managed package, or Another ISV's managed package that interacts with Accounting Seed’s components, or Custom code developed by your company

Resolution

Workarounds if the error is caused by a button like Create & Post

Resolve the Issue

What To Do If You Keep Exceeding Apex CPU Time Limit?

Apex CPU time limit exceeded - Please help!