• Maurissa Thomas
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello all, 
I am currently trying to finish my Apex Specilaist Superbadge, I am stuck on Challenge 4 which is testing automation logic. I keep recieving this error and i'm not sure where I am wrong: 

Challenge Not yet complete... here's what's wrong:
The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome.

I will post my test code along with my helper class in the comments. I have tested for up to 300 records so I'm not sure what the problem is. Any help or points in the right direction would be greatly appreciated. 
 
Thank you!
Hello All, 

I am currently working on Apex Specialist Superbadge and Im not sure where Im going wrong. Here is the error message I am getting; 

Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Update failed. First exception on row 0 with id 5003h000002ZNFwAAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MaintenanceRequest: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null. Class.MaintenanceRequestHelper.updateWorkOrders: line 19, column 1 Trigger.MaintenanceRequest: line 3, column 1: []

My Apex Helper Code is as follows; 

public class MaintenanceRequestHelper {
public static void updateWorkOrders() {
        // TODO: Complete the method to update workorders
      List<Case> caseList =[
            SELECT id, Equipment__c, status, type, subject, vehicle__c, Equipment__r.Maintenance_Cycle__c
            FROM Case    
            Where Status = 'Closed' AND Type IN ('Repair','Routine Maintenance')];
   
   
    
    List<Case> newCases = new List<Case>();
          for (Case c: caseList){ 
              Case nc = new Case();
              nc.Type = 'Routine Maintenance'; 
              nc.subject = 'New Routine Maintenance';
              nc.Vehicle__c = c.Vehicle__c; 
              nc.Equipment__c = c.Equipment__c; 
              nc.Date_Reported__c = date.today(); 
              nc.Date_Due__c = date.today().addDays(Integer.valueOf(c.Equipment__r.Maintenance_Cycle__c)); 
            
              newCases.add(nc); 
          }
        
    insert newCases;
           
    }        
    
}

Please help with an explanation as I'd really like to understand what I need to do to fix this. 
Thank you all!
 
Hello all, 
I am currently trying to finish my Apex Specilaist Superbadge, I am stuck on Challenge 4 which is testing automation logic. I keep recieving this error and i'm not sure where I am wrong: 

Challenge Not yet complete... here's what's wrong:
The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome.

I will post my test code along with my helper class in the comments. I have tested for up to 300 records so I'm not sure what the problem is. Any help or points in the right direction would be greatly appreciated. 
 
Thank you!