You need to sign in to do that
Don't have an account?
bikla78
APEX code best practice- how to update class and trigger names in production
I have a bunch of class and trigger names I need to update in production. What is the safest way to do this. Should I clone my production into the sandbox and make sure evertything is in sync. Then, I plan on modifying the class and trigger names in Sandbox and deploy it in Production. 2 questions
1. Will this be safe and and will it work?
2. If I want to update the class and trigger name in sandbox, how can I do this in eclipse? When I try overwriting the name of the class and the trigger callling the class, i get an error
Thanks
All Answers
You are correct that the only way to make the updates in your production environment is to make the alterations using a Sandbox or DE org and then deploying them to your production org. It is perfectly safe and the correct way to make the changes you desire. The naming issue within Eclipse where it errors out may be unavoidable. To get around it you may need to add your class and trigger updates to the Sandbox or DE org using the standard user interface (Setup > Develop > Apex Classes, etc) and then refresh your project within Eclipse prior to deploying the code.
-greg
Thanks Greg but when I change the class and trigger names in the sandbox, do I simply just edit the name of the class and the trigger inside the code and press save or is there a section in a eclipse where i change in properties?
When you use Eclipse to create a new trigger or class you are prompted for the name of that class/trigger and some other details. I believe that Eclipse then stores those properties locally to perform validation on the code prior to pushing it out to Salesforce. I am not aware of a way to alter those properties within Eclipse after the class/trigger is created.
However, if you simply log into the DE/Sandbox org and navigate to the class or trigger section, you can click edit next to the code you want to change, retype the name and simply click save. It will apply that name change based on the value stored in the code.
Now by making the change in the UI and not in Eclipse you create a disconnect between Eclipse and Salesforce. And because you cannot change the properties of that code within Eclipse you literally need to refresh the trigger folder and class folder in Eclipse.
Within Eclipse right click on the folder, choose "Force.com" from the options and then "Refresh from Server" in the subsequent list of options. Eclipse should go out to Salesforce and pull back the triggers/classes with the newest properties based on what is live in the DE org.
-greg