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
GambitGambit 

Undeploy

Hi, I have deployed some code into my production using eclipse .
Now, for some reason i want to get the code and trigger out of  production. Is there a way to undeploy the class and the trigger from production and if so how do i go forward doing that.
 
ColtonisColtonis
um yeah... same question. 
 
This seems kinda dumb to me... first of all, deployed code can't be deleted on the production database. 
But if I try to change my trigger and deploy it, i get errors saying I can't because the object field is not the right type, but if I try to change the object field it says it can't because the field is referenced in the trigger! (Which it already said I can't change).
 
I tried simultaneous redeployment of object and trigger but the object field didn't update and the trigger failed the check.
 
The only thing I can think of is to blow away the entire custom object that I am using (hopefully the trigger will go with it?) and redploy object and trigger simultaneously. This is a horrible solution especially when you take into consideration that you would lose any information saved in one of those object's records. Not to mention, What would you do if you made the trigger for the Account object? Can't blow that one away now can we. Is there something I'm missing here, like a way to Undeploy?
WilmerWilmer
Hi Gambit,

I´m not sure if this could be the best way but for sure it works.

1. Make a backup copy of the trigger and class you want to delete from server.
2. Delete the corresponding files from your Sandbox/Developer Eclipse project.
3. Run the deploy to server option, so this time Eclipse will mark your trigger and class in red saying those programs could be deleted.

I hope this helps.
GambitGambit

Hey thanks a lot for your input.

I have one more question. Is there a way where you could simply deactivate the trigger rather than just deleting it.

All i am doing is overriding a couple of fields through the trigger. If the trigger is deleted, i dont want it to mess my production

THanks

WilmerWilmer
Hi Coltonis,

FIRST OF ALL: I suggest to make a backup of your data , do every required change in a Sandbox or Developer org before, test it and later update it in production.

What you need to do is to deactivate your trigger first, then update the field type (if that's what you need to do) and finally, update your trigger code if probably you could be using some special Apex Functions that depends on the former field type (like toUpperCase, Round, etc), then reactivate your trigger again.

Warning: If you want to change a Number field type to String, be sure you have a backup, because sometimes when you do the type change numeric some records could have added a '.0' at the end of the number or get scientific notation.


GambitGambit

Thank you Wilmer, I appreciate your time and contribution here. Also, if you ever learn of any other way to 'undeploy' do let me know. I will do the same if i do.

Thanks again

WilmerWilmer
Well, in fact there is another one but no with Eclipse yet. This is by using Ant Deployment Toolkit which I consider is much faster than Eclipse in a Deployment processing comparison.

With a single a "undeploy" command you can do it too and as I told you, faster. Try it if you want to.