Skip to main content
edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Source Link
Subhash
  • 1.7k
  • 1
  • 14
  • 26

How to avoid the 101 SOQL Queries Limitation

I have one Trigger and Test Class (which is having the coverage of above 80%) that needs to be moved to Production.

There are already some test classes available in the Production where these test classes will be validated on every changeset deployment.

Problem:

While moving the changeset of this trigger and test class, It is hitting the 101 SOQL Queries on the test classes which are already there in Production. I have already used Test.StartTest() and Test.StopTest() functions for every possible scenarios in my test Class.

Note: I used Test.IsRunningTest() in Trigger to solve this 101 SOQL Exception but at that time, It is not covering 75%.

Is there any way to solve this situation now?