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
New-Admin-85New-Admin-85 

Issue reactivating trigger on production

Hi all,

 

I am having difficulties reactivating a trigger on the production. Every time I try to deploy it, I get an error not enough coverage. I used change set in salesforce for deployment.

 

I deactivated the same trigger before and was able to reactivate it again, but this time it wont work. 

No changes were made on the trigger or its associated test class. However, I did add 2 apex classes (one of them is a test) after the first time I reactivated the trigger. 

I delete both classes from production and tried to reactivate the trigger again, but no luck. 

 

Small note: the trigger I want to reactivate and its test class were created by a developer but is no longer available and I am not very good with coding to make proper modifications if necessary.

 

Can anyone please help wit this issue or point me to the right derection of what to do. 

 

Thanks

spatel_cespatel_ce

Hi,

 

When you migrate from Sandbox to Production, you need to attach test classes with that too. So, before migrating trigger back in production again, just run test classes again to check code coverages. If your test results are passed then select trigger and test class for trigger in your change set.

 

-Sawan

 

Hit the Kudos button if any post helps you - Mark the answer as solution, It might help others running to into similar problem in future.

New-Admin-85New-Admin-85

Hi,

 

Thanks for your help.

 

I run the test class on the sandbox and all test methods pass, however the code coverage is still zero for the trigger. 

Last time I reactivated the trigger I used the same test and worked fine.

Is there something else I can try?

 

kind regards 

spatel_cespatel_ce

When you run test class, it will just show green correct sign with [pass] as result in Apex Test Execution window. But after again open apex trigger and check for code coverage as it should be above 75%, and if you hadn't make any changes in Trigger and Test Class, it will be fine.

 

If it shows 0% in code coverage, then go to Apex Test class and open a test class for that trigger and hit on "Run Test" button. After completion of exection, just refresh your Apex Trigger class and it will update code coverage. Then try to migrate to production.

 

-Sawan

 

Hit the Kudos button if any post helps you - Mark the answer as solution, It might help others running to into similar problem in future.

New-Admin-85New-Admin-85

Hi Sawan,

 

On the sandbox everything went well. The test passed and the code coverage is at 100%.

When I try to deploy it on production, the issue stays the same, no coverage.

 

Kind regards

spatel_cespatel_ce

I tried with my Unlimited edition Org and it is working for me. I was working with test trigger and it worked with me. Though I tried with Change Sets only. Though I noticed in other posts that they are having trouble, if they are using or ever used Eclipse IDE with triggers.

 

Here is one last try to do, try to upload a renamed sandbox trigger and its test class to production. I know that this is not a good solution but lets give a shot.

 

-Sawan

 

Hit the Kudos button if any post helps you - Mark the answer as solution, It might help others running to into similar problem in future.