Too Many SOQL Error: 101

Explain about "Too Many SOQL Error: 101"

Error: System.LimitException: Too many SOQL queries: 101
errors occur when you exceed SOQL queries governor limit. Actuval limit is "you can run up to a total 100 SOQL queries in a single call or context".
resolving this situation:
Change your code by fallowing apex code best practices so that the number of SOQL fired is less than 100.
If you need to change the context, you can use @future annotation which will run the code asynchronously.
Apex runs on a multi-tenant platform, the apex run time engine strictly enforces limits to ensure code does not monopolize shared resources.

Best practices:
  • Avoid SOQL queries in for loops.
  • Fallow Apex code key principals while writing Triggers and bulk requests.

No comments:

Powered by Blogger.