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
Dea73Dea73 

Can't figure out DML Exception

Hi All,

 

Can someone help me figure out what the problem is with the update unit test?

I'm trying to see if my trigger will pass the 200 mark :)

 

static testmethod void test_CircuitHandling(){ 
    
    List<Circuits__c> newckts = new List<Circuits__c>();
    for(integer i=0; i<=199; i++ ){
     
     newckts.add(new Circuits__c(Circuit_Status__c = 'Pending', RecordTypeId = '01230000000LSN1AAO'));
     
      
     
    }
    Database.Saveresult[] results = Database.insert(newckts);
    System.assertEquals(results.size(), 200);
    
    Set<Id> Ids = new Set<Id>();
    for(Circuits__c ckts : newckts){
     
     Ids.add(ckts.Id);
    }
    List<Circuits__c> upList = [select Circuit_Status__c, Id From Circuits__c Where Id =: Ids];
    List<Circuits__c> updList = new List<Circuits__c>();
    for(Circuits__c cktList: upList){
     cktList.Circuit_Status__c = 'Active';
     cktList.Service_Start_Date__c = system.today();
        updList.add(cktList);
     
    }
    if(!updList.isEmpty()){
    Database.Saveresult[] upResults = Database.update(updList); 
    }
    
   }

 

Thanks in advance,

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Starz26Starz26

Does it say why?? Look in the debug log and it will tell you the reason why as well.

All Answers

Dea73Dea73

I forgot to mention that it gives me the  CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY error

Starz26Starz26

Does it say why?? Look in the debug log and it will tell you the reason why as well.

This was selected as the best answer