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
bhollandewrbhollandewr 

Getting the 20 SOQL Limit Error Trying to Test Visualforce Controller

I thought the limit for Visualforce Controllers was 100 SOQL calls?

ngabraningabrani

The limit for number of SOQL statements that can be executed from an Apex controller is 20. Pls take a look at the following link for some best practices -

 

http://wiki.developerforce.com/index.php/Best_Practice:_Avoid_SOQL_Queries_Inside_FOR_Loops

Imran MohammedImran Mohammed

Yes the limit for number of SOQL queries is 100.

But if you have Controller method that gets executed from a trigger, then the limit will be 20.

bhollandewrbhollandewr

Right, but that's not what I'm experiencing.  I'm using execute anonymous to run the test functions against my visualforce controller.  A trigger may be called in the process, but the entry point is the visualforce controller.  What am I missing?