• tpetty
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Can someone please assist with the code below....What I am trying to achieve is to set the default date of a record to the 'Order Hand off date + 5 if the Industry code is not equal to '010 Waste Water' OR 020 Fish & if the Industry code is equal is equal to these categories to add 40 days onto the 'Order Hand off date'

IF(engProject.T_C_Review_Required__c == 'Yes' && (
        engProject.Industry_Code__c != '010 Waste Water' ||
        engProject.Industry_Code__c != '020 Fish')){
       
                    dueDate = ProjectActivityHelper.addBusinessDays(engProject.Order_Hand_off_Date__c,5);
                    projActivity = ProjectActivityHelper.buildProjectActivity(engProject.ID, dueDate,
                    'Order Processing', 'Approve T&C', engProject.OwnerID);
                    projectActivityList.add(projActivity);
              }
             
       IF(engProject.T_C_Review_Required__c == 'Yes' && (
        engProject.Industry_Code__c == '010 Waste Water' ||
        engProject.Industry_Code__c == '020 Fish')){
       
                    dueDate = ProjectActivityHelper.addBusinessDays(engProject.Order_Hand_off_Date__c,40);
                    projActivity = ProjectActivityHelper.buildProjectActivity(engProject.ID, dueDate,
                    'Order Processing', 'Approve T&C', engProject.OwnerID);
                    projectActivityList.add(projActivity);
              }

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!
 
  • August 18, 2013
  • Like
  • 0