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

Too many script statements: 200001..

Please suggest something so i can restrict this.....

Use multiplce apex classes links chunks.. do not use a apex class with too much code. there is a limit for that



Your code(or the way it is called) needs to be optimised. Unfortunately that is almost definitely going to be alot of work. There are some resources that may help, depending on what you are doing 



Edwin VijayEdwin Vijay

You will get this error when the number of executing statements is large... Even if your code is small and you have a loop which keeps on executing many times you may get this error...


There is no other go than to optimize your code...

Thanks for the reply's...but the class XMLDom is the only class that comes for parsing my XML which i get from webservice call.....
Does this class accumulates that many Script statements if my response string is large ??

i jsut wanna put a restriction so that atleast my application runs fine before it hit the limit.....m tryin putting some limits as changing my code certainly not an option as it has lots of functionalities.....



The size of the reply is probably your problem. The getScriptStatements() method of the Limits class(


) can help you figure out at which point the governor limit is hit. Simply insert a few of the method calls in sensible areas an check the debug logs.