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
kieran.osullivankieran.osullivan 

Can't Deploy an Inactive Trigger

I have a trigger which I want to disable (it generates data for one field and the import I am doing doesn't need that data generated)

 

If the trigger is active I can deploy it.  If the trigger is inactive I can't deploy it.

 

WHAT THE HELL IS THIS ABOUT?

 

I have another trigger which I can deploy when it is inactive.

Vinit_KumarVinit_Kumar

Not sure what you exactly want to say.

Prafull G.Prafull G.
Are you trying to deploy the Trigger to Production instance. If yes, make sure there is not test failures/code coverage issue when you try to deploy it as Inactive.

Cheers!
Bindhyachal Kumar SinghBindhyachal Kumar Singh

Hi Kieran

 

You can deploy inactive as well as active trigger both.

 

Firstly you have to write test cases for trigger and run it in sandbox. make sure that trigger should be active when running test cases. Trigger coverage should be above 75% without exception.

 

After that inactive trigger and then deploy with test class.

kieran.osullivankieran.osullivan

When the trigger is active it has 100% THAT IS 100% TEST COVERAGE.

Then I de-activate it.

Then I deploy to the production org.

Then I login to the Production org.

Then I validat it. 

NOW IT HAS 74% TEST COVERAGE.

Yes the test classes are deployed to production.

If I run the tests in Production the tests IN PRODUCTION show 100% coverage.

 

HOW CAN AN INACTIVE TRIGGER HAVE LESS TEST COVERAGE

Bindhyachal Kumar SinghBindhyachal Kumar Singh

Hi kieran

 

You can use force.com IDE and make a force.com project for production org.

 

Copy the sandbox trigger code in to production directly via force.com IDE.

kieran.osullivankieran.osullivan

I have also tried commenting out the code.  IT STILL DOES NOT DEPLOY WTF!

Dima BabarykinDima Babarykin

Make sure that tests logic doesn't depend on your trigger - so when you deactivate trigger some tests (expecting trigger will execute some logic - e.g. update some fields etc.) fail and code coverage becomes less than it was.