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
tpettytpetty 

Apex Code Trigger Error

I only have 74% Code coverage & at a loss on how to resolve in order to load my updated code

I have expanded my Apex class to cover more 'trigger' scenarios in our Sandbox and cannot deploy to Production because I only have 74% code coverage. The code automatically creates 'Project Activities' based on answers to four questions defined on the parent 'Engineering Project' header object. I also expanded the trigger test criteria to cover all appropriate scenarios but get the following error when I try to deploy both classes. 
 
Deployment Error
 
EngineeringProjectTriggerTest.myUnitTest() Class 118 Failure Message: "System.LimitException: Too many SOQL queries: 101", Failure Stack Trace: "Class.ProjectActivityHelper.buildActivitiesDependantOnProject: line 118, column 1 Class.ProjectActivityHelper.buildActivityList: line 88, column 1 Class.EngineeringProjectTriggerTest.myUnitTest: line 166, column 1"

Should mention I am new to Apex & building on code previously created by a SF consultant however the code itself has tested successfully in our Sandbox and is doing what I need it to do. The only problem I have is deploying the amended code to production.
 
Unfortunately I can't post my Apex classes as there are too many characters however I hope someone can help provide a novice with some guidance on what to do next!
 
anup-prakashanup-prakash

It could be that you have your soql query inside of a for loop.. of the triggers could be running in recurrsion.