You need to sign in to do that
Don't have an account?
matto
Move trigger from sandbox to production
I wrote my first trigger, and it works great in my sandbox. I would like to promote it to my production environment. We are using Enterprise edition. How exactly do I move a new trigger to production? Is there is an easy set of instructions online somewhere? I cannot seem to find one.
Thanks for your reply. Neing a newbie, I was looking for a little more detail, but I figured it out. Here are the steps in case others need them in the future.
1. Download Eclipse from this site.
http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/ganymedesr2
2. Go to this page and follow the instructions for installing the Force.com IDE within Eclipse. http://wiki.developerforce.com/index.php/Force.com_IDE_Installation_for_Eclipse_3.4.x
3. After Eclipse restarts, go to the File menu and create a new Project. Select a Force.com project.
4. Enter your login credentials including security token. Don’t forget to add the .sandbox_name after your username to access your sandbox.
5. Select to download all Apex and Visualforce data from your sandbox.
6. In the Package Explorer window on the left, expand the tree under the “src” folder, then expand again under “triggers”.
7. Select your trigger.
8. Click on the fourth button over in the toolbar at the top, deploy to server.
9. Enter your login credentials for your production environment and follow the instructions.
Note: The first time I tried this, I got an error than the trigger could not be deployed because I did not have adequate test coverage. You need to create a simple test class that runs functions to test your trigger code before deploying, I did know this before running into it. Your test class needs deployed to production before you deploy the trigger.
All Answers
You can deploy code to your production instance in a few ways.
1) Using the Force.com IDE (search look at the references for this if you don't already use it)
- With your Production instance setup as a Force.com project, you can simply copy that trigger into the workspace of your Production instance and then build the project
2) Using the Force.com Migration Tool (search and look at the reference for thsi if you don't already use it)
- This allows you to deploy code using ANT (this requires some setup)
There might be other ways to deploy code, but I think these two are the most commonly used methods.
Thanks for your reply. Neing a newbie, I was looking for a little more detail, but I figured it out. Here are the steps in case others need them in the future.
1. Download Eclipse from this site.
http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/ganymedesr2
2. Go to this page and follow the instructions for installing the Force.com IDE within Eclipse. http://wiki.developerforce.com/index.php/Force.com_IDE_Installation_for_Eclipse_3.4.x
3. After Eclipse restarts, go to the File menu and create a new Project. Select a Force.com project.
4. Enter your login credentials including security token. Don’t forget to add the .sandbox_name after your username to access your sandbox.
5. Select to download all Apex and Visualforce data from your sandbox.
6. In the Package Explorer window on the left, expand the tree under the “src” folder, then expand again under “triggers”.
7. Select your trigger.
8. Click on the fourth button over in the toolbar at the top, deploy to server.
9. Enter your login credentials for your production environment and follow the instructions.
Note: The first time I tried this, I got an error than the trigger could not be deployed because I did not have adequate test coverage. You need to create a simple test class that runs functions to test your trigger code before deploying, I did know this before running into it. Your test class needs deployed to production before you deploy the trigger.
*** Deployment Log ***
Result: FAILED
Date: March 11, 2014 9:27:56 AM PDT
# Deployed From:
Project name: move trigger to production
Username: richard_harris@sti.com.omron1
Endpoint: test.salesforce.com
# Deployed To:
Username: richard_harris@sti.com
Endpoint: www.salesforce.com
# Deploy Results:
File Name: package.xml
Full Name: package.xml
Action: UPDATED
Result: SUCCESS
Problem: n/a
File Name: triggers/UpdateZipCode.trigger
Full Name: UpdateZipCode
Action: UPDATED
Result: SUCCESS
Problem: n/a
# Test Results:
Run Failures:
TestUpdateZipCode.myUnitTest System.QueryException: List has no rows for assignment to SObject
UpdateZipCode Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
Average test coverage across all Apex Classes and Triggers is 64%, at least 75% test coverage is required.