+ Start a Discussion

Import trigger from sandbox to production

Hi there,

I need to import a custom case trigger from sandbox to production. Any idea how to do that,



It seems you are trying to deploy a trigger from sandbox to production, for that you can do it via 2 ways:-

1. You can deploy it via ANT

2. You can use the Force.com Ecllipse IDE to deploy the trigger to production.

3. For that you need to checkout your sandbox org into ecllipse as a Force.com project.

4. Once you have checked out , you need to ascertain your trigger has appropriate coverage of  min 75% only then you can deploy it. Coverage is provided to triggers using TestMethod in which data is created, updated and deleted to ensure all the code of the trigger is executed.

5. Once the coverage has been provided, in the Tree view of the project you can expand the node/folder for triggers and select your "trigger to be deployed" and also the apex class containing the test method for your trigger. Now right click to access the menu which gives among other options an option called "Force.com" . This option has submenu option called "deploy to server" on clicking this option the system will bring up a wizard which will ask for sandbox and production credentials. Follow the steps of the wizard to deploy the trigger to production.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.



Andy BoettcherAndy Boettcher

You can also push it to Prod via a Change Set.  If you aren't an Eclipse IDE (Force.com IDE) user, Change Sets are far easier to use than installing the IDE or trying to get the Migration Tool working.


As the previous post said - you're going to need to make sure you have a Test Class set to provide code coverage over your trigger (if you need help starting that, just ask) and then read this link to start on your way with Change Sets.





Ker Vin.ax1237Ker Vin.ax1237

Just remember to write the test case to create the data rather then using actual entries in the database. Otherwise, when the data is later deleted, you will get wierd stuff such as 70% coverage in the PRODUCTION environment


(True story here: I took over administration from another guy and almost had a conniption when I saw it was 70% coverage. Turns out he created the data manually, used SOQL to select data during the deployment, then erased the data manually. When the test is re-run....if fails....and the coverage drops. Had to re-write all his test cases before I could deploy a VALIDATION rule back to production ^_^;)