0

So I have a trigger and my production org has no Apex Classes. I'm trying to deploy this trigger to production but I'm getting a code coverage error. How can I deploy this trigger to production?

The only code I have in this production org is about 5 visualforce pages and 0 apex classes.

1
  • You need to create a test class for the trigger before deploying it. Add it to the change set with the apex trigger and execute it while deploying. Jun 15, 2016 at 22:32

1 Answer 1

5

In order to deploy any Apex Trigger, Salesforce requires that the trigger body has greater than 0% code coverage, in addition to requiring that system-wide coverage be at least 75%. So you cannot deploy an Apex Trigger to production without any Apex Class, you need at least one to generate the necessary coverage.

Take a look at How To Test Your Apex Triggers and the Testing Apex Triggers Trailhead Module if you need to better understand how to write such a test.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .