0

I've read several threads and documentation related to this issue but can't seem to figure out what I need to do differently. I'm trying to activate triggered sends via Marketing Cloud Connect in Sales Cloud to send emails upon lead creation. I've followed instructions to create an Apex Trigger on the Lead object in Sandbox and am trying to deploy in production using change sets. When trying to validate, I get the code coverage error below:

Code Coverage Failure: The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage. Trig_Lead

My trigger is:

    trigger Trig_Lead on Lead (after insert, after update)
{
    if (!Test.isRunningTest())
    {
        et4ae5.triggerUtility.automate('Lead');
    }
}

I understand that there's likely a test class I have to create or include but I'm not sure exactly what that would look like or what the next step is here. When compiling all tests and running in sandbox I seemed to have 50% code coverage on this trigger but when I run all tests when validating in production, it fails because several tests failed.

Any guidance here would be greatly appreciated!

  • 2
    This trigger is literally impossible to test, because it has been written to skip all of the logic when run from a within a test. If you own the code, you should remove the Test.isRunningTest check and figure out a better way to work around whatever issue led to its introduction. – Adrian Larson Jul 24 at 14:46

Your Answer

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

Browse other questions tagged or ask your own question.