You need to sign in to do that
Don't have an account?
Ashish Verma
Stuck with soql 101 error while running test class for a trigger helper.
Hi , I added a few methods in an already present trigger helper class. Now when I ran the test class for it, i am getting Too many SOQL queries error. Any ideas how can I resolve this issue?
Greetings to you!
This error appears when you exceed the Execution Governors Limit (you can run up to a total 100 SOQL queries in a single call or context): https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
To fix the issue, change your code 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.
Best practices to avoid exceeding the Governors Limit:
Since Apex runs on a multi-tenant platform, the Apex runtime engine strictly enforces limits to ensure code doesn't monopolize shared resources.
Reference: https://help.salesforce.com/articleView?id=000181404&type=1
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas