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
Richard Rodriguez 1Richard Rodriguez 1 

Salesforce Marketing Cloud Connector Triggered Send ERRORS

We are attempting to create our first Triggered Send via the Salesforce Marketing Cloud Connector, but besides encountering several issues that we had to overcome, we are now stuck with an error that we haven't been able to find a solution for.

1. We updated to the latest Marketing Cloud Connector package
2. Configured the Marketing Cloud Connector to enable the Referral (ts2__Application__c) object
3. Created the Triggered Send
4. Clicked [ Activate ]
ERROR: Before activating a triggered send the appropriate Apex Trigger must be created for the following object: TS2__APPLICATION__C. Please refer to Marketing Cloud Help for more information.
5. As per https://help.salesforce.com/articleView?id=mc_co_configure_objects_and_triggers.htm&type=5, created Apex Trigger in sandbox (Trig_Application)
trigger Trig_Application on ts2__application__c (after insert, after update) { et4ae5.triggerUtility.automate('ts2__application__c'); }
6. As per https://help.salesforce.com/articleView?id=mc_co_test_object_triggers.htm&type=5, created Apex Test Class in sandbox (Test_Trig_Application)
{
  private static testmethod void ApplicationTriggerTest()
  {     
           insert new et4ae5__Configuration__c(et4ae5__Support_Ticket_Recipient__c = 'example@example.com');
           Test.startTest();
           ts2__Application__c c = new ts2__Application__c(ts2__Job__c='a0x6F00000Jusxj',ts2__Candidate_Contact__c='0039000000tbvxG');
           // Insert contact
           insert c;
           // If no exceptions occurred, it was successful 
           System.assert(!String.isBlank(c.Id));
           Test.stopTest();
  }
}
ERROR: Compile Error: Unexpected token '{'. at line 1 column 1
7. As per https://developer.salesforce.com/forums/?id=906F0000000DC95IAG, updated the Apex Test Class in sandbox (Test_Trig_Application)
@isTest
  private class Test_Trig_Application {
  static testMethod void validateTrig_Application() {    
           insert new et4ae5__Configuration__c(et4ae5__Support_Ticket_Recipient__c = 'example@example.com');
           Test.startTest();
           ts2__Application__c c = new ts2__Application__c(ts2__Job__c='a0x6F00000Jusxj',ts2__Candidate_Contact__c='0039000000tbvxG');
           // Insert Application
           insert c;
           // If no exceptions occurred, it was successful 
           System.assert(!String.isBlank(c.Id));
           Test.stopTest();
  }
}
8. As per https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm, created Outbound Changeset including Trig_Application and Test_Trig_Application
9. As per https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm, deployed Inbound Change Sets with Test Option 'Default'
ERROR: 10 Test Failures
10. As per https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm, deployed Inbound Change Sets with Test Option 'Run specified tests' - Test_Trig_Application
ERROR: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trig_Application: execution of AfterInsert caused by: et4ae5.MCBaseException.InvalidParameterException: Whoops! Marketing Cloud Connect does not have access to the selected object. Contact your administrator to enable objects for Marketing Cloud Connect triggered sends. Class.et4ae5.triggerUtility.automate: line 30, column 1 Trigger.Trig_Application: line 1, column 1: [] 
Stack Trace: Class.ApplicationTriggerTest.validateTrig_Application: line 14, column 1
11. As per https://salesforce.stackexchange.com/questions/210508/unable-to-deploy-trigger-for-triggered-sends-to-activate, updated Trig_Application
trigger Trig_Application on ts2__Application__c (after insert, after update)
{
    if (!Test.isRunningTest()){
        et4ae5.triggerUtility.automate('ts2__Application__c');
        }
}
12. As per https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm, deployed Inbound Change Sets with Test Option 'Run specified tests' - Test_Trig_Application
ERROR: The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Trig_Application
13. As per https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm, deployed Inbound Change Sets with Test Option 'Default' - SUCCESS
14. Clicked [ Activate ]
ERROR: A problem with the OnClick JavaScript for this button or link was encountered:
{faultcode:'soapenv:Client', faultstring:'System.NullPointerException: Attempt to de-reference a null object
(et4ae5)',}

So, as far as I can tell, this would be the last step in finalising the process.

I contacted Salesforce with regards to this error, but they referred me here, as we are not on a Premier Success plan.