+ Start a Discussion

System.LimitException: Apex CPU time limit exceeded

could any one tell me why i am getting this exception


System.LimitException: Apex CPU time limit exceeded

Best Answer chosen by raghava520

Ordinary synchronous Apex code (triggers, controllers) can use up to 10 seconds of CPU time.  Exceeding this time limit will throw the exception you're getting.  Basically, your code is taking too long.  If you can't find any way to optimize the code, you should consider making it run in a future method (a method annotated as @future).  This is because asynchronous Apex code (@future, Schedulable, Batchable) can use up to 60 seconds of CPU time.


Check out the discussion of Limits here: Understanding Execution Governors and Limits


If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!


-Glyn Anderson
Certified Salesforce Developer | Certified Salesforce Administrator