[SalesForce] Too many code statements: 200001 … why do this error occur

I searched but didn't found anything about this error, but I'm facing it now.
"Too many code statements: 200001"

The error specifies "code statements", I was familiar with script statements but didn't knew we have code statements error also in APEX.

How do we rectify this kind of error, does anyone know?

Best Answer

Apex statements are any coded instruction that performs an action. In Apex, statements must end with a semicolon and can be one of the following types:

  • Assignment, such as assigning a value to a variable
  • Conditional (if-else)
  • Loops
  • Do-while
  • While
  • For
  • Locking
  • Data Manipulation Language (DML)
  • Transaction Control
  • Method Invoking
  • Exception Handling

This was a pretty good blog on how to reduce your total statements. http://www.tgerm.com/2010/02/apex-script-statements-reduction-tips.html

Check out the Understanding Execution Governors and Limits doc to find out more information about the limits. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm

Related Topic