You need to sign in to do that
Don't have an account?
myancey
Help me deploy my first trigger
Stumbling thru examples, I have successfully written and tested my first trigger. I did this in my Sandbox and now want to deploy it to production. I've installed the Migration Tool , Ant and Java SDK and done the required configurations. But, the instructions for using Ant to move move it are too confusing and use too many terms I'm not familiar with. Plus the Migration Tool User Guide is 25 pages long. It can't be that complex to move a 6 line trigger from Sandbox to production. Please help!
As you know now the failing classes weren't in your package. However, everytime you deploy something to production all tests are run and an overall code coeverage of 75% is required (including your new code).
You need to update the classes in production so that your overall test coverage is above 75%. You won't be able to deploy anything until then.
The classes can be edited in two ways:
Since you deleted the classes in your Sandbox you're looking at having to use Eclipse. I guess there's also a third way which would be to create the classes again in your Sandbox and then editing them there.
The errors you're seeing is because the test methods are trying to insert a record where the required field Committed_MRR__c hasn't been assigned a value.
I think if you get that fixed you'll be a step closer to deploying your own trigger.
/Søren Nødskov Hansen
All Answers
It is easy to deploy using eclipse or you can use the UI to deploy, go to App setup-Deploy and make the connection from ur sandbox to production and just deploy the trigger, it is very easy to deploy this way, even yuou have help on the top right if you have any questions regarding this functionality, let me know if you have any questions
Hi,
As already suggested I'd use Eclipse with the Force.com plug-in. However, there is another way of doing this which requires no 3rd party software.
You could use the Change Set feature. You can find it here: Setup --> Deploy --> Outbound Change Sets.
Here you have the option to create an Outbound Change Set containing your trigger and test class (and a lot of other stuff, if needed). You simply need to establish a connection from your Sandbox to your Production and you're good to go.
Hope it helps.
/Søren Nødskov Hansen
Well, this is a lot easier, thanks.
I've bumped into my next issue. I ran my tests in my sandbox and got 100% coverage. I built a outbound Change Set that contained only my trigger and uploaded it. Then switched to my production org and deployed it. But it failed saying there was only 23% coverage. I don't understand why it was 100% in the sandbox and only 23% in production.
It's much easier. Thanks
In my sandbox my tests show 100% coverage but my production deploy fails stating only 23% coverage. Any ideas?
Hi,
Is your test method placed in the same file as your trigger or is it in a separate file?
If it is in a separate file you need to also add that to the Change Set.
/Søren Nødskov Hansen
I think I may be having the opposite problem. When my deploy fails, it lists a bunch of other test classes that were written by others. My trigger may have 100% coverage but these others don't. I think I need to exclude them from the Change Set. How would I do that? Also, I don't even see my test class in the list. Is that becuase it had no errors? See next post
Failed ( 5 )
I deleted all of these test classes, except mine, from the sandbox. It's just a copy of prod, right? Built a new Change Set and uploaded it to production. But, when I tried to deploy it, I got exactly the same results as above. So, these test classes that are failing - the ones I didn't write - are in production, They were never in my package. I do I fix this?
As you know now the failing classes weren't in your package. However, everytime you deploy something to production all tests are run and an overall code coeverage of 75% is required (including your new code).
You need to update the classes in production so that your overall test coverage is above 75%. You won't be able to deploy anything until then.
The classes can be edited in two ways:
Since you deleted the classes in your Sandbox you're looking at having to use Eclipse. I guess there's also a third way which would be to create the classes again in your Sandbox and then editing them there.
The errors you're seeing is because the test methods are trying to insert a record where the required field Committed_MRR__c hasn't been assigned a value.
I think if you get that fixed you'll be a step closer to deploying your own trigger.
/Søren Nødskov Hansen
There's a third way. Since my trigger and test class were small, I copied them to a text file, then refreshed the sandbox getting all of the deleted test classes back, then re-created my new stuff from the text files. So, I've recovered from the errant deletions, but I still have to fix my predecessors errors. Or get him to fix them.
Yup, a refresh of your Sandbox will certainly get you your deleted stuff back.
And yes, you still need to attend to the errors as you won't be able deploy anything to production before your overall test coverage is 75% or higher.
/Søren Nødskov Hansen
Success!
I ended up deleting an installed AppExchange app that the consultants installed but was never used. This removed all of the errors but one. Then, I had to inactivate a pile of validation rules that check for required fields that were causing a different trigger to fail. Once I did this, my Change Set deployed on the first try. Turned all the val rules back on and have tested my trigger successfully in production.
Thank you very much for your assitance and patience on my first trigger deploy.