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

Class cannot be saved inactive

Hi There,

I need to deactivate a trigger and it's test class through Eclipse with the plugin.

If I edit the meta file and set the state to inactive and try to deploy I get the error 'Class cannot be saved inactive'.

Can anyone advise on how to do this?

Open the trigger-meta.xml file of this trigger and set the <active>false</active> then redeploy the trigger using Eclipse.
Hi There,

Thanks for your reply.

My meta file uses the <status> tag which I have set to Inactive (as the options allow). Eclipse will not let me deploy this. All I get is the error 'Class cannot be saved inactive'. I think this may be different to yours, maybe a different version of the api? I am using 13.0.

Has anyone else got any idea?


You need to mark it as inactive in your sandbox.  Save it then go thru the deploy process.  The error you are seeing is because you are trying to save the production version to inactive.

Hi There,

Yes I agree that I need to do it in the sandbox first. But I can't see how to do that. If I look at the class in the sandbox through a browser I cannot see anyway to deactivate the class.

I clicked on Edit and unlike with triggers there is no checkbox for toggling activity.

Sorry if I'm being stupid and missing something obvious.

Hey guys, I'm having the same problem, I'm trying to temporarily deactivate an apex class using the <status> metatags, and it won't let me set it to Inactive, are there been any solutions or workarounds to deactivating apex classes?
Seems the only workarounds are:

1. Delete your trigger.
2. Comment out all code in your trigger and your test class.
3. Remove permissions for all users against this trigger. This effectively disables it.

All very poor solutions. I hope they fix this bug soon.

Good luck!


I am having a similar issue.  I am trying to disable a trigger that is causing errors during mass updates.  When I set the status to "False" on the trigger XML, and run the tests... I get an error because the tests fail.  When I change the status on the trigger itself, I don't get an error, but I can't deploy it.

<—xml version="1.0" encoding="UTF-8"–>
<ApexTrigger xmlns="">

 When I comment out the trigger, run tests, and deploy... no change is made to the code. Eclipse doesn't even see that the trigger has changed when deploying.  It is like the comments are ignored.

Anyone have any other suggestions or tips for disabling a trigger using these suggestions?  I know that I am missing something.


Message Edited by jhamlet on 11-24-2008 03:00 PM
Nitin PalmureNitin Palmure
the solution given by benwrigley is best one. it works ...