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
LorrMcLorrMc 

Apex Trigger stopped working and has code coverage of 0% percent while Class has 100% code coverage

Hi, 

We have a apex class and trigger that always workded fine however yesterday all stoped, the class  and trigger were both at 0% code coverage yesterday so I ran the tests and cleared the past test results but still no joy. 
This morning the Class has a code coverage of 100% but the trigger is still at 0% although the when I test this the batch is showing up in the job list as complete. 
Any advice would be welcome, also is there a way I see what data was sent in the batch or where it was sent to?

Thank you in advance. 

Lorr
SaurabhGupta_SaurabhGupta_
Hi Lorr,

Can you please paste your class and trigger code to understand the issue?

Saurabh
LorrMcLorrMc
Hi  Saurabh,

Thank you for the response, please see below. 

Class 

/**
 * Author: paulk@nebulaconsulting.co.uk
 * Created: 06/12/2017
 * Description: (if required)
 */

global class TGMGApiContactWorker extends Nebula_Api.NebulaSingleApiWorker {

  private TGMGApi api;

  global TGMGApiContactWorker() {
    super(
      TGMGApiContactWorker.class.getName(),
      new Nebula_Tools.FieldSetUtils.QueryBuilder('Contact', 'TGMG_Status__c = \'Pending\' AND TGMG_Region_Id__c != null')
        .setFieldSet('TGMG_Fields')
        .build(),
      'TGMG_Status__c',
      10
    );
    api = new TGMGApi();
  }

  global override sObject executeSingle(sObject obj) {
    return (sObject)api.sendContact((Contact)obj);
  }


}

Trigger



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 *  @who    Samuel Arroyo (CloudSocius)
 *  @what   Send Contact to The Grey Matter Group
 *  @when   06/10/2015
 */
trigger SendContactToTGMG on Contact (after update) {

//    // Get Contacts that just got "Actual Service Start Date" filled
//    Set<Id> contactIds = new Set<Id>();
//    for (Contact contact : Trigger.new)
//        if (contact.Email != null &&
//            contact.TGMG_Region_Id__c != null &&
//            (
//                (Trigger.oldMap.get(contact.Id).Email != contact.Email) ||
//               (Trigger.oldMap.get(contact.Id).TGMG_Region_Id__c != contact.TGMG_Region_Id__c) ||
//               (Trigger.oldMap.get(contact.Id).TGMGUserIsActive__c != contact.TGMGUserIsActive__c) ||
//                (Trigger.oldMap.get(contact.Id).Initial_5_Day_Training_End_Date__c != contact.Initial_5_Day_Training_End_Date__c)
//            ))
//            contactIds.add(contact.Id);
//
//    // Send Contacts to TGMG
//    if (!contactIds.isEmpty())
//        TGMG.sendContacts(contactIds);
}