4

I am in the process of updating some code I wrote a year ago. Due to some changes made to our organizations support structure, my code is no longer valid. I attempted to modify the code to reflect the changes but I am running into an error that I can't seem to resolve:

I am getting an error when attempting to validate my test code:

"REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]"

Below is the Class, the Test Class, the Trigger, and the full debug data.

This is the Class

    public with sharing class SoftwareUpdate {
    public void createCases(List<Asset> assets){
      List<Case> casesToCreate = new List<Case>();
      List<Id> listofAccountIds = new List<Id>();
       Map<Id, Id> mapaccountidtocontactid = new Map<Id, Id>();

      for(Asset acc:assets){
          if(acc.Status == 'In Warranty'){
             listofAccountids.add(acc.AccountId);
          }
       }

       List <AccountContactRole> listPimaryContacts = [Select Id, contactid, Isprimary, accountid from AccountContactRole where isprimary=true AND accountid in :listofAccountids];
       for(AccountContactRole cr: listPimaryContacts){
          mapaccountidtocontactid.put(cr.accountid, cr.contactid);
       }

      for(Asset acc:assets){
         if (acc.Software_Update_Available__c == TRUE){
             Case caseToAdd = new Case();
             caseToAdd.AccountId = acc.AccountId;
             caseToAdd.Subject = 'Software Upgrade Available';
             caseToAdd.ContactId = mapaccountidtocontactid.get(acc.AccountId);
             //caseToAdd.Asset = acc.Instrument_Model__c;
             casesToCreate.add(caseToAdd);
                }
      }
      if (casesToCreate.size() > 0)
          insert casesToCreate;
    }

    }

This is the Test Class

@isTest
private class SoftwareUpdateTest {

   static List<Asset> getTestAssets(){
    List<Asset> testAssets = new List<Asset> {};
    Asset ta = new Asset();
    ta.Software_Update_Available__c = True;
    testAssets.add(ta);
    return testAssets;
   }

   // test SoftwareUpdate.createCases
   private static testMethod void testCreateCases() {

    List<Asset> testAssets = getTestAssets();

    SoftwareUpdate helper = new SoftwareUpdate();
    Test.startTest();
    helper.createCases(testAssets);
    Test.stopTest();
   }

   // test SoftwareUpdateTrigger.trigger
   private static testMethod void testSoftwareUpdateTrigger() {

    // insert the asserts with update available false
    List<Asset> testAssets = getTestAssets();
    testAssets[0].Software_Update_Available__c = false;
    insert testAssets;

    Test.startTest();
    // now set update available to true
    testAssets[0].Software_Update_Available__c = true;
    // that should cause the trigger to create cases
    update testAssets;
    Test.stopTest();
   }
}

This is the Trigger

trigger SoftwareUpdateTrigger on Asset (before update) {
  // hold assets for which cases need to be created
  List<Asset> swUpdates = new List<Asset>();

  for (Asset record:trigger.new)
  {
     // make sure we only include assets for which Software_Update_Available__c has been changed to true
     if (record.Software_Update_Available__c &&
        !trigger.oldMap.get(record.Id).Software_Update_Available__c){

        swUpdates.add(record);
     }
  }

  // call SWClass only if there are any assets for which cases need to be created
  if (swUpdates.size() > 0){
     SoftwareUpdate helper = new SoftwareUpdate();
     helper.createCases(swUpdates);
  }
}

Full Debug Log

27.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
10:41:24.975 (8975563819)|EXECUTION_STARTED
10:41:24.975 (8975589042)|CODE_UNIT_STARTED|[EXTERNAL]|01pM0000000Aicl|SoftwareUpdateTest.testCreateCases
10:41:24.975 (8975822760)|HEAP_ALLOCATE|[71]|Bytes:3
10:41:24.975 (8975849531)|HEAP_ALLOCATE|[76]|Bytes:152
10:41:24.975 (8975877962)|HEAP_ALLOCATE|[272]|Bytes:408
10:41:24.975 (8975916671)|HEAP_ALLOCATE|[285]|Bytes:408
10:41:24.975 (8975948523)|HEAP_ALLOCATE|[379]|Bytes:48
10:41:24.975 (8975985218)|HEAP_ALLOCATE|[131]|Bytes:6
10:41:24.976 (8976006902)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:1
10:41:24.976 (8976016013)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:23
10:41:24.976 (8976031248)|METHOD_ENTRY|[2]|01pM0000000Aicl|SoftwareUpdateTest.SoftwareUpdateTest()
10:41:24.976 (8976036895)|STATEMENT_EXECUTE|[2]
10:41:24.976 (8976042510)|STATEMENT_EXECUTE|[2]
10:41:24.976 (8976047793)|METHOD_EXIT|[2]|SoftwareUpdateTest
10:41:24.976 (8976093916)|HEAP_ALLOCATE|[50]|Bytes:5
10:41:24.976 (8976119225)|HEAP_ALLOCATE|[56]|Bytes:5
10:41:24.976 (8976133247)|HEAP_ALLOCATE|[63]|Bytes:7
10:41:24.976 (8976173493)|STATEMENT_EXECUTE|[13]
10:41:24.976 (8976180437)|STATEMENT_EXECUTE|[15]
10:41:24.976 (8976205528)|METHOD_ENTRY|[15]|01pM0000000Aicl|SoftwareUpdateTest.getTestAssets()
10:41:24.976 (8976318840)|STATEMENT_EXECUTE|[4]
10:41:24.976 (8976324454)|STATEMENT_EXECUTE|[5]
10:41:24.976 (8976333220)|HEAP_ALLOCATE|[5]|Bytes:4
10:41:24.976 (8976375267)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
10:41:24.976 (8976401554)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
10:41:24.976 (8976408015)|VARIABLE_SCOPE_BEGIN|[5]|testAssets|LIST<Asset>|true|false
10:41:24.976 (8976417845)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:24.976 (8976443887)|VARIABLE_ASSIGNMENT|[5]|testAssets|{"serId":1,"value":[]}|0x2771af25
10:41:24.976 (8976449391)|STATEMENT_EXECUTE|[6]
10:41:24.976 (8976471982)|HEAP_ALLOCATE|[6]|Bytes:4
10:41:24.976 (8976587961)|VARIABLE_SCOPE_BEGIN|[6]|ta|Asset|true|false
10:41:24.976 (8976611736)|VARIABLE_ASSIGNMENT|[6]|ta|{}|0x18a1ba5e
10:41:24.976 (8976617215)|STATEMENT_EXECUTE|[7]
10:41:24.976 (8976687376)|VARIABLE_ASSIGNMENT|[7]|this.Software_Update_Available__c|true|0x18a1ba5e
10:41:24.976 (8976693745)|STATEMENT_EXECUTE|[8]
10:41:24.976 (8976741098)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:24.976 (8976756794)|STATEMENT_EXECUTE|[9]
10:41:24.976 (8976766619)|METHOD_EXIT|[15]|01pM0000000Aicl|SoftwareUpdateTest.getTestAssets()
10:41:24.976 (8976772878)|VARIABLE_SCOPE_BEGIN|[15]|testAssets|LIST<Asset>|true|false
10:41:24.976 (8976799050)|VARIABLE_ASSIGNMENT|[15]|testAssets|{"serId":1,"value":[{"Software_Update_Avai (8 more) ...":true}]}|0x2771af25
10:41:24.976 (8976804948)|STATEMENT_EXECUTE|[17]
10:41:24.984 (8984371168)|HEAP_ALLOCATE|[17]|Bytes:1
10:41:24.984 (8984409385)|METHOD_ENTRY|[1]|01pM0000000Aicb|SoftwareUpdate.SoftwareUpdate()
10:41:24.984 (8984415977)|STATEMENT_EXECUTE|[1]
10:41:24.984 (8984442796)|HEAP_ALLOCATE|[17]|Bytes:5
10:41:24.984 (8984450288)|STATEMENT_EXECUTE|[1]
10:41:24.984 (8984464845)|METHOD_EXIT|[1]|SoftwareUpdate
10:41:24.984 (8984486677)|HEAP_ALLOCATE|[17]|Bytes:4
10:41:24.984 (8984505383)|CONSTRUCTOR_ENTRY|[17]|01pM0000000Aicb|<init>()
10:41:24.984 (8984541291)|VARIABLE_SCOPE_BEGIN|[1]|this|SoftwareUpdate|true|false
10:41:24.984 (8984574007)|VARIABLE_ASSIGNMENT|[1]|this|{}|0x2f807df1
10:41:24.984 (8984586975)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
10:41:24.984 (8984600589)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:6
10:41:24.984 (8984616220)|VARIABLE_SCOPE_BEGIN|[2]|this|system.ApexBaseClass|true|false
10:41:24.984 (8984632401)|VARIABLE_ASSIGNMENT|[2]|this|{}|0x2f807df1
10:41:24.984 (8984650988)|STATEMENT_EXECUTE|[1]
10:41:24.984 (8984660542)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
10:41:24.984 (8984679632)|CONSTRUCTOR_EXIT|[17]|01pM0000000Aicb|<init>()
10:41:24.984 (8984685475)|VARIABLE_SCOPE_BEGIN|[17]|helper|SoftwareUpdate|true|false
10:41:24.984 (8984701740)|VARIABLE_ASSIGNMENT|[17]|helper|{}|0x2f807df1
10:41:24.984 (8984706838)|STATEMENT_EXECUTE|[18]
10:41:24.984 (8984769247)|STATEMENT_EXECUTE|[1]
10:41:24.986 (8986049712)|STATEMENT_EXECUTE|[19]
10:41:24.986 (8986093572)|METHOD_ENTRY|[19]|01pM0000000Aicb|SoftwareUpdate.createCases(LIST<Asset>)
10:41:24.986 (8986122951)|VARIABLE_SCOPE_BEGIN|[2]|this|SoftwareUpdate|true|false
10:41:24.986 (8986141394)|VARIABLE_ASSIGNMENT|[2]|this|{}|0x2f807df1
10:41:24.986 (8986147680)|VARIABLE_SCOPE_BEGIN|[2]|assets|LIST<Asset>|true|false
10:41:24.986 (8986180263)|VARIABLE_ASSIGNMENT|[2]|assets|{"serId":1,"value":[{"Software_Update_Avai (8 more) ...":true}]}|0x2771af25
10:41:24.986 (8986212542)|HEAP_ALLOCATE|[3]|Bytes:5
10:41:24.986 (8986219318)|STATEMENT_EXECUTE|[2]
10:41:24.986 (8986223072)|STATEMENT_EXECUTE|[3]
10:41:24.986 (8986272081)|HEAP_ALLOCATE|[3]|Bytes:4
10:41:24.986 (8986311536)|SYSTEM_CONSTRUCTOR_ENTRY|[3]|<init>()
10:41:24.986 (8986344202)|SYSTEM_CONSTRUCTOR_EXIT|[3]|<init>()
10:41:24.986 (8986350301)|VARIABLE_SCOPE_BEGIN|[3]|casesToCreate|LIST<Case>|true|false
10:41:24.986 (8986359088)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:24.986 (8986375061)|VARIABLE_ASSIGNMENT|[3]|casesToCreate|{"serId":1,"value":[]}|0x23b43597
10:41:24.986 (8986380803)|STATEMENT_EXECUTE|[4]
10:41:24.986 (8986391521)|HEAP_ALLOCATE|[4]|Bytes:4
10:41:24.986 (8986403734)|SYSTEM_CONSTRUCTOR_ENTRY|[4]|<init>()
10:41:24.986 (8986419634)|SYSTEM_CONSTRUCTOR_EXIT|[4]|<init>()
10:41:24.986 (8986425111)|VARIABLE_SCOPE_BEGIN|[4]|listofAccountIds|LIST<Id>|true|false
10:41:24.986 (8986451653)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:24.986 (8986466910)|VARIABLE_ASSIGNMENT|[4]|listofAccountIds|{"serId":1,"value":[]}|0xc2a5ed1
10:41:24.986 (8986472356)|STATEMENT_EXECUTE|[5]
10:41:24.986 (8986486184)|HEAP_ALLOCATE|[5]|Bytes:4
10:41:24.986 (8986499550)|VARIABLE_SCOPE_BEGIN|[5]|mapaccountidtocontactid|MAP<Id,Id>|true|false
10:41:24.986 (8986521236)|VARIABLE_ASSIGNMENT|[5]|mapaccountidtocontactid|{"serId":1,"value":{}}|0x31b6f194
10:41:24.986 (8986761627)|HEAP_ALLOCATE|[7]|Bytes:5
10:41:24.986 (8986787656)|HEAP_ALLOCATE|[7]|Bytes:8
10:41:24.986 (8986799578)|VARIABLE_SCOPE_BEGIN|[7]|acc|Asset|true|false
10:41:24.986 (8986819441)|VARIABLE_ASSIGNMENT|[7]|acc|{"Software_Update_Avai (8 more) ...":true}|0x18a1ba5e
10:41:24.986 (8986825680)|STATEMENT_EXECUTE|[7]
10:41:24.986 (8986834016)|STATEMENT_EXECUTE|[8]
10:41:24.986 (8986853122)|HEAP_ALLOCATE|[7]|Bytes:5
10:41:24.986 (8986875989)|VARIABLE_ASSIGNMENT|[7]|acc|null|
10:41:24.986 (8986881772)|STATEMENT_EXECUTE|[13]
10:41:24.986 (8986889886)|HEAP_ALLOCATE|[13]|Bytes:117
10:41:24.986 (8986900329)|HEAP_ALLOCATE|[13]|Bytes:4
10:41:24.986 (8986910778)|HEAP_ALLOCATE|[13]|Bytes:7
10:41:24.987 (8987315221)|SOQL_EXECUTE_BEGIN|[13]|Aggregations:0|select Id, contactid, Isprimary, accountid from AccountContactRole where (isprimary = true and accountid IN :tmpVar1)
10:41:24.990 (8990135692)|SOQL_EXECUTE_END|[13]|Rows:0
10:41:24.990 (8990157947)|HEAP_ALLOCATE|[13]|Bytes:4
10:41:24.990 (8990167591)|HEAP_ALLOCATE|[13]|Bytes:0
10:41:24.990 (8990216261)|HEAP_ALLOCATE|[13]|Bytes:4
10:41:24.990 (8990229194)|VARIABLE_SCOPE_BEGIN|[13]|listPimaryContacts|LIST<AccountContactRole>|true|false
10:41:24.990 (8990253399)|VARIABLE_ASSIGNMENT|[13]|listPimaryContacts|{"serId":1,"value":[]}|0x3ea8fb72
10:41:24.990 (8990425537)|HEAP_ALLOCATE|[14]|Bytes:5
10:41:24.990 (8990450847)|VARIABLE_ASSIGNMENT|[14]|cr|null|
10:41:24.990 (8990457496)|STATEMENT_EXECUTE|[14]
10:41:24.990 (8990503916)|HEAP_ALLOCATE|[18]|Bytes:5
10:41:24.990 (8990525762)|HEAP_ALLOCATE|[18]|Bytes:8
10:41:24.990 (8990535742)|VARIABLE_SCOPE_BEGIN|[18]|acc|Asset|true|false
10:41:24.990 (8990556334)|VARIABLE_ASSIGNMENT|[18]|acc|{"Software_Update_Avai (8 more) ...":true}|0x18a1ba5e
10:41:24.990 (8990562400)|STATEMENT_EXECUTE|[18]
10:41:24.990 (8990593002)|STATEMENT_EXECUTE|[19]
10:41:24.990 (8990597119)|STATEMENT_EXECUTE|[20]
10:41:24.990 (8990613884)|HEAP_ALLOCATE|[20]|Bytes:4
10:41:24.990 (8990716013)|VARIABLE_SCOPE_BEGIN|[20]|caseToAdd|Case|true|false
10:41:24.990 (8990732953)|VARIABLE_ASSIGNMENT|[20]|caseToAdd|{}|0x48141981
10:41:24.990 (8990738238)|STATEMENT_EXECUTE|[21]
10:41:24.990 (8990824706)|VARIABLE_ASSIGNMENT|[21]|this.AccountId|null|0x48141981
10:41:24.990 (8990831415)|STATEMENT_EXECUTE|[22]
10:41:24.990 (8990840215)|HEAP_ALLOCATE|[22]|Bytes:26
10:41:24.990 (8990884063)|VARIABLE_ASSIGNMENT|[22]|this.Subject|"Software Upgrade Ava (6 more) ..."|0x48141981
10:41:24.990 (8990890103)|STATEMENT_EXECUTE|[23]
10:41:24.990 (8990986800)|VARIABLE_ASSIGNMENT|[23]|this.ContactId|null|0x48141981
10:41:24.990 (8990993672)|STATEMENT_EXECUTE|[25]
10:41:24.991 (8991033958)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:24.991 (8991063646)|HEAP_ALLOCATE|[18]|Bytes:5
10:41:24.991 (8991083284)|VARIABLE_ASSIGNMENT|[18]|acc|null|
10:41:24.991 (8991115313)|STATEMENT_EXECUTE|[29]
10:41:24.991 (8991161024)|DML_BEGIN|[29]|Op:Insert|Type:Case|Rows:1
10:41:24.991 (8991183408)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:41:25.246 (9246441793)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Case
10:41:25.333 (9333226610)|WF_RULE_EVAL_BEGIN|Assignment
10:41:25.333 (9333254468)|WF_SPOOL_ACTION_BEGIN|Assignment
10:41:25.333 (9333261005)|WF_ACTION|.
10:41:25.333 (9333265862)|WF_RULE_EVAL_END
10:41:25.333 (9333277968)|WF_RULE_EVAL_BEGIN|Response
10:41:25.333 (9333297267)|WF_SPOOL_ACTION_BEGIN|Response
10:41:25.333 (9333301967)|WF_ACTION|.
10:41:25.333 (9333305704)|WF_RULE_EVAL_END
10:41:25.333 (9333316922)|WF_RULE_EVAL_BEGIN|Workflow
10:41:25.333 (9333340915)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Case Assignment|01QE000000051Wx|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.402 (9402492430)|WF_RULE_FILTER|[Case : Case Owner does not contain Support] 
AND [Case : Status equals 1 - Awaiting First Response]
10:41:25.402 (9402525977)|WF_RULE_EVAL_VALUE|005E0000000FVHz
10:41:25.402 (9402551079)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.402 (9402557000)|WF_CRITERIA_END|true
10:41:25.441 (9441266280)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Customer Notification|01QE00000004vBA|ON_CREATE_ONLY
10:41:25.441 (9441335916)|WF_RULE_FILTER|[Case : Status equals 1 - Awaiting First Response]
10:41:25.441 (9441376059)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.441 (9441383765)|WF_CRITERIA_END|true
10:41:25.441 (9441410086)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Campaign Contact Rules|01QE000000052KO|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.441 (9441467134)|WF_RULE_FILTER|[Case : Contract Inquiry equals true]
10:41:25.441 (9441477814)|WF_RULE_EVAL_VALUE|0
10:41:25.441 (9441483370)|WF_CRITERIA_END|false
10:41:25.441 (9441499963)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Customer Attempted Re-Open|01QE000000050lc|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.441 (9441532440)|WF_RULE_FILTER|[Case : Status equals * Attempted Re-Open]
10:41:25.441 (9441548037)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.441 (9441554378)|WF_CRITERIA_END|false
10:41:25.441 (9441572484)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Case Re-Opened by Support|01QE000000051wb|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.441 (9441606147)|WF_RULE_FILTER|[Case : Status equals * Re-Opened by Support]
10:41:25.441 (9441621697)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.441 (9441627345)|WF_CRITERIA_END|false
10:41:25.441 (9441644260)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|notify case owner|01QE00000004xi1|ON_CREATE_ONLY
10:41:25.441 (9441684829)|WF_RULE_FILTER|[Case : Status equals 1 - Awaiting First Response]
10:41:25.441 (9441710343)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.441 (9441715932)|WF_CRITERIA_END|true
10:41:25.441 (9441739215)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Case Account|01QE00000004QC5|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442070879)|WF_FORMULA|Formula:NOT ( ISBLANK (  Customer_Asset__c ))|Values:Customer_Asset__c=null
10:41:25.442 (9442079948)|WF_CRITERIA_END|false
10:41:25.442 (9442099477)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Military Closed|01QE000000051RY|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442134963)|WF_RULE_FILTER|[Case : Status equals Closed - Military]
10:41:25.442 (9442150064)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442155959)|WF_CRITERIA_END|false
10:41:25.442 (9442172748)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Long Term Hold|01QE000000051vi|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442206712)|WF_RULE_FILTER|[Case : Status equals * - Long Term Hold]
10:41:25.442 (9442221465)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442226995)|WF_CRITERIA_END|false
10:41:25.442 (9442242803)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Send Survey|01QE000000051x5|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442277612)|WF_RULE_FILTER|[Case : Status equals * Customer Survey]
10:41:25.442 (9442291170)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442296748)|WF_CRITERIA_END|false
10:41:25.442 (9442311906)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Awaiting Customer Response|01QE000000050aZ|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442343181)|WF_RULE_FILTER|[Case : Status equals 3 - Awaiting Customer Response]
10:41:25.442 (9442356922)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442362307)|WF_CRITERIA_END|false
10:41:25.442 (9442377530)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|No Response|01QE00000004zsI|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442408816)|WF_RULE_FILTER|[Case : Status equals No Response]
10:41:25.442 (9442421880)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442427069)|WF_CRITERIA_END|false
10:41:25.442 (9442442043)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Quoting|01QE00000004zhU|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.442 (9442472426)|WF_RULE_FILTER|[Case : Status equals 5 - Quoting]
10:41:25.442 (9442485792)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.442 (9442492122)|WF_CRITERIA_END|false
10:41:25.442 (9442507607)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|First response|01QE00000004zjL|ON_ALL_CHANGES
10:41:25.447 (9447515269)|WF_FORMULA|Formula:ISPICKVAL(PRIORVALUE(Status),"1 - Awaiting First Response")
!= ISPICKVAL ((Status),"1 - Awaiting First Response")|Values:Status=1 - Awaiting First Response
10:41:25.447 (9447526431)|WF_CRITERIA_END|false
10:41:25.447 (9447546436)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Priority - Warranty|01QE000000050dT|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.447 (9447580404)|WF_RULE_FILTER|[Case : Type of Call equals SVC ¬タモ Warranty]
10:41:25.447 (9447589425)|WF_RULE_EVAL_VALUE|
10:41:25.447 (9447593348)|WF_CRITERIA_END|false
10:41:25.447 (9447604890)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Support Contract|01QE000000050mG|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.447 (9447949582)|WF_FORMULA|Formula:Customer_Asset__r.Support_Contract__c  = TRUE|Values:Customer_Asset__r.Support_Contract__c=null
10:41:25.447 (9447956526)|WF_CRITERIA_END|false
10:41:25.447 (9447972465)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Send Survey Automatically|01QE00000004k69|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.448 (9448001273)|WF_RULE_FILTER|[Case : Status equals * Customer Survey]
10:41:25.448 (9448015520)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.448 (9448019938)|WF_CRITERIA_END|false
10:41:25.448 (9448031493)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Case Resolved|01QE00000004zPG|ON_CREATE_OR_TRIGGERING_UPDATE
10:41:25.448 (9448054678)|WF_RULE_FILTER|[Case : Status equals 10 - Resolved]
10:41:25.448 (9448065233)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.448 (9448069430)|WF_CRITERIA_END|false
10:41:25.448 (9448093765)|WF_SPOOL_ACTION_BEGIN|Workflow
10:41:25.448 (9448120827)|WF_RULE_INVOCATION|[Case: 14466 500M0000003zqgG]
10:41:25.448 (9448134554)|WF_EMAIL_ALERT|Id=01WE00000008nm5|CurrentRule:Case Assignment (Id=01QE000000051Wx)
10:41:25.458 (9458527888)|WF_EMAIL_SENT
10:41:25.458 (9458578891)|WF_RULE_INVOCATION|[Case: 14466 500M0000003zqgG]
10:41:25.458 (9458600949)|WF_EMAIL_ALERT|Id=01WE00000008lMP|CurrentRule:Customer Notification (Id=01QE00000004vBA)
10:41:25.461 (9461479423)|WF_EMAIL_SENT
10:41:25.461 (9461506936)|WF_RULE_INVOCATION|[Case: 14466 500M0000003zqgG]
10:41:25.461 (9461520661)|WF_EMAIL_ALERT|Id=01WE00000008mHp|CurrentRule:notify case owner (Id=01QE00000004xi1)
10:41:25.752 (9752113912)|WF_EMAIL_SENT|Template:00XE0000000RC4g|Recipients:bpomeroy@spectroinc.com |CcEmails:
10:41:25.752 (9752145460)|WF_ACTION| Email Alert: 3;
10:41:25.752 (9752151265)|WF_RULE_EVAL_END
10:41:25.752 (9752166063)|WF_RULE_EVAL_BEGIN|Escalation
10:41:25.752 (9752200472)|WF_CRITERIA_BEGIN|[Case: 14466 500M0000003zqgG]|Escalate 1|01QE000000050b3
10:41:25.752 (9752209277)|WF_RULE_ENTRY_ORDER|1
10:41:25.752 (9752250461)|WF_RULE_FILTER|[Case : Status equals 2 - Investigating, 1 - Awaiting First Response]
10:41:25.752 (9752276271)|WF_RULE_EVAL_VALUE|1 - Awaiting First Response
10:41:25.752 (9752280878)|WF_CRITERIA_END|true
10:41:25.752 (9752288344)|WF_ESCALATION_RULE
10:41:25.763 (9763990081)|WF_SPOOL_ACTION_BEGIN|Escalation
10:41:25.764 (9764039398)|WF_RULE_INVOCATION|[Case: 14466 500M0000003zqgG]
10:41:25.769 (9769817479)|WF_ESCALATION_ACTION|01UE00000000Ip3|Thu Apr 17 12:41:00 GMT 2014
10:41:25.769 (9769840670)|WF_ACTION|.
10:41:25.769 (9769846101)|WF_RULE_EVAL_END
10:41:25.809 (9809922634)|WF_TIME_TRIGGERS_BEGIN
10:41:25.820 (9820725484)|WF_ACTIONS_END| Email Alert: 3; Escalate: 1;
10:41:25.820 (9820738040)|CODE_UNIT_FINISHED|Workflow:Case
10:41:25.827 (9827632452)|DML_END|[29]
10:41:25.827 (9827798769)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:41:25.827 (9827831514)|METHOD_EXIT|[19]|01pM0000000Aicb|SoftwareUpdate.createCases(LIST<Asset>)
10:41:25.827 (9827839774)|STATEMENT_EXECUTE|[20]
10:41:20.815 (9829217674)|CUMULATIVE_LIMIT_USAGE
10:41:20.815|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

10:41:20.815|TESTING_LIMITS
10:41:20.815|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 1 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 1 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

10:41:20.815|CUMULATIVE_LIMIT_USAGE_END

10:41:25.829 (9829277672)|CODE_UNIT_FINISHED|SoftwareUpdateTest.testCreateCases
10:41:25.829 (9829288950)|EXECUTION_FINISHED
10:41:25.921 (9921415947)|EXECUTION_STARTED
10:41:25.921 (9921428849)|CODE_UNIT_STARTED|[EXTERNAL]|01pM0000000Aicl|SoftwareUpdateTest.testSoftwareUpdateTrigger
10:41:25.921 (9921620387)|HEAP_ALLOCATE|[71]|Bytes:3
10:41:25.921 (9921646979)|HEAP_ALLOCATE|[76]|Bytes:152
10:41:25.921 (9921686134)|HEAP_ALLOCATE|[272]|Bytes:408
10:41:25.921 (9921721095)|HEAP_ALLOCATE|[285]|Bytes:408
10:41:25.921 (9921752993)|HEAP_ALLOCATE|[379]|Bytes:48
10:41:25.921 (9921789315)|HEAP_ALLOCATE|[131]|Bytes:6
10:41:25.921 (9921811814)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:1
10:41:25.921 (9921820952)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:23
10:41:25.921 (9921834058)|METHOD_ENTRY|[2]|01pM0000000Aicl|SoftwareUpdateTest.SoftwareUpdateTest()
10:41:25.921 (9921839851)|STATEMENT_EXECUTE|[2]
10:41:25.921 (9921844689)|STATEMENT_EXECUTE|[2]
10:41:25.921 (9921849932)|METHOD_EXIT|[2]|SoftwareUpdateTest
10:41:25.921 (9921873101)|HEAP_ALLOCATE|[50]|Bytes:5
10:41:25.921 (9921898887)|HEAP_ALLOCATE|[56]|Bytes:5
10:41:25.921 (9921912690)|HEAP_ALLOCATE|[63]|Bytes:7
10:41:25.921 (9921939699)|STATEMENT_EXECUTE|[24]
10:41:25.921 (9921943910)|STATEMENT_EXECUTE|[27]
10:41:25.921 (9921960737)|METHOD_ENTRY|[27]|01pM0000000Aicl|SoftwareUpdateTest.getTestAssets()
10:41:25.921 (9921989907)|STATEMENT_EXECUTE|[4]
10:41:25.921 (9921994079)|STATEMENT_EXECUTE|[5]
10:41:25.922 (9922006911)|HEAP_ALLOCATE|[5]|Bytes:4
10:41:25.922 (9922022712)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
10:41:25.922 (9922031754)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
10:41:25.922 (9922039268)|VARIABLE_SCOPE_BEGIN|[5]|testAssets|LIST<Asset>|true|false
10:41:25.922 (9922050120)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:25.922 (9922080663)|VARIABLE_ASSIGNMENT|[5]|testAssets|{"serId":1,"value":[]}|0x2c3d311a
10:41:25.922 (9922086068)|STATEMENT_EXECUTE|[6]
10:41:25.922 (9922107428)|HEAP_ALLOCATE|[6]|Bytes:4
10:41:25.922 (9922139571)|VARIABLE_SCOPE_BEGIN|[6]|ta|Asset|true|false
10:41:25.922 (9922158346)|VARIABLE_ASSIGNMENT|[6]|ta|{}|0x6562b8a6
10:41:25.922 (9922162919)|STATEMENT_EXECUTE|[7]
10:41:25.922 (9922214601)|VARIABLE_ASSIGNMENT|[7]|this.Software_Update_Available__c|true|0x6562b8a6
10:41:25.922 (9922220375)|STATEMENT_EXECUTE|[8]
10:41:25.922 (9922248534)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:41:25.922 (9922263408)|STATEMENT_EXECUTE|[9]
10:41:25.922 (9922272829)|METHOD_EXIT|[27]|01pM0000000Aicl|SoftwareUpdateTest.getTestAssets()
10:41:25.922 (9922279161)|VARIABLE_SCOPE_BEGIN|[27]|testAssets|LIST<Asset>|true|false
10:41:25.922 (9922303997)|VARIABLE_ASSIGNMENT|[27]|testAssets|{"serId":1,"value":[{"Software_Update_Avai (8 more) ...":true}]}|0x2c3d311a
10:41:25.922 (9922309879)|STATEMENT_EXECUTE|[28]
10:41:25.922 (9922327251)|HEAP_ALLOCATE|[28]|Bytes:8
10:41:25.922 (9922366782)|VARIABLE_ASSIGNMENT|[28]|this.Software_Update_Available__c|false|0x6562b8a6
10:41:25.922 (9922372573)|STATEMENT_EXECUTE|[29]
10:41:25.922 (9922426514)|DML_BEGIN|[29]|Op:Insert|Type:Asset|Rows:1
10:41:25.922 (9922447999)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:41:26.015 (10015706758)|DML_END|[29]
10:41:26.015 (10015804835)|VF_PAGE_MESSAGE|Required fields are missing: [Name]
10:41:26.015 (10015907445)|EXCEPTION_THROWN|[29]|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
10:41:26.016 (10016871853)|HEAP_ALLOCATE|[29]|Bytes:125
10:41:26.016 (10016966348)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]

Class.SoftwareUpdateTest.testSoftwareUpdateTrigger: line 29, column 1
10:41:26.016 (10016985917)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]

Class.SoftwareUpdateTest.testSoftwareUpdateTrigger: line 29, column 1
10:41:21.003 (10017006475)|CUMULATIVE_LIMIT_USAGE
10:41:21.003|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 1 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

10:41:21.003|CUMULATIVE_LIMIT_USAGE_END

10:41:26.017 (10017049077)|CODE_UNIT_FINISHED|SoftwareUpdateTest.testSoftwareUpdateTrigger
10:41:26.017 (10017065129)|EXECUTION_FINISHED

Any help you can provide would be greatly appreciated!

4
  • Do you understand the error message ? Apr 15 '14 at 15:30
  • I get that it is looking for a required field, but I thought I had removed that requirement. From what SF_user is saying, my IDE may be requiring fields that do not exist. When I attempt to validate the code on salesforce.com itself, I still get the same error so I am unsure why the IDE is coming into play. Apr 15 '14 at 17:07
  • Both compilation and execution always happen server-side in salesforce, so I'm not sure what he believes is the relation with your IDE. Does your error message come with a line nr ? ifso, could you be so kind to mark that in your test class ? Apr 15 '14 at 17:13
  • Line 29, column 1 Apr 15 '14 at 17:15
4

Your method getTestAssets() is generating records of the standard Asset object. That object has a text type name field, I fail to see how you could make that not-required. You may no longer require this in your business processes, it is a required field for the platform. (To my knowledge that can not be changed - my response is based on this).

static List<Asset> getTestAssets(){
    List<Asset> testAssets = new List<Asset> {};
    Asset ta = new Asset();
    ta.Software_Update_Available__c = True;
    testAssets.add(ta);
    return testAssets;
   }

You will need to populate the name field. Additionally, I believe either a contact or account parent is required for any Asset record. Additionally to that, testing triggers is best done by mass creating records to test for SOQL and DML limits. (Bulkification)

For instance:

static List<Asset> getTestAssets(){
        List<Asset> testAssets = new List<Asset>;

        //create an Account
        Account ac = new Account();
        ac.name  = 'DummyAccount';
        // you may need to populate additional required fields on the account object for your org
        insert ac; 

        //we will generate 100+ Asset records
        for(integer i = 0;i<101;i++){
            Asset ta = new Asset();
            ta.Name = 'DummyName' + i;  //an Asset must have a Name
            ta.accountId = ac.id;//an Asset must have an account or contact parent
            ta.Software_Update_Available__c = True;
            testAssets.add(ta);
        }
        return testAssets;
 }
1
  • That's got it. I'm having trouble with the trigger now, but I think I know what that is about. Thanks for the help!!! Apr 15 '14 at 18:29
1

It seems that the older version of your Case object contained a required field Name. And the newer not.

Make sure that the files are up-to-date.

What IDE do you use ?

2
  • Eclipse Indigo with the most recent Force.com Plugins Apr 15 '14 at 17:06
  • The case object has never had a Name field. Apr 15 '14 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.