-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get Apex Trigger to Deploy in Production #199
Comments
I was originally on 1.1, so have upgraded both production and sandbox to 1.2 which now gives me the coverage error. I rebuilt all the triggers in the sandbox to make sure they had the additional line mentioned in a previous issue and have tried using a change set to deploy the changes with no joy so far. The test classes are still all failing with not enough coverage, and I tried removing one to see if that stopped the error in production, and I can't even remove them from production at the moment. Will have to see if I can edit to add the line in mentioned. Although I've not edited previously so will have to see how I go. |
Please make sure you are using v1.20 and also your generated test class code (shown on the Manage Child Trigger page) has call to "dlrs.RollupService.testHandler" it. If it does not, please go back to your Sandbox, click Manage Child Triggers, then allow it to remove the trigger and test classes, then re-deploy it (by clicking Deploy on the same page), this will generate a new style test class. This new style test class will give you more information as to the underlying issue causing the code coverage, which is likely that the child objects require more test data to be passed to them in the test code. |
Also @LALeif the challange with the tool as it is now, and as the platform was until recently (prior to Summer'15), is that when new code is deployed to production (even via this tool), ALL tests had to be re-run and pass. It seems you've got some old tests that while may have run in the past no longer do, this is a pain to have to resolve these for sure, but better in the long run as they will be doing their job better. As an aside, since Summer'15, the underlying SF Metadata API now permmits my code in the tool to deploy its code to production and only insist on the its test working and not existing ones, this will for sure make this particular pain your going through with historic tests failing, go away. Its a high priority enhancement for me to make, but i don't yet have time scales for from me personally, though their are now a few other community developers working on this tool. |
Hi, Have done all of that, as a previous article suggested, but I can’t deploy the updated ones to production. It all works merrily in Sandbox. Guessing I’ll need to try and manually put that in using the Developer console (of which I have virtually no experience so hoping it’s as simple as copy, paste, save)?? Thanks Sharon Cannon | Global PMO Manager [http://www.phoenixbs.com/Libraries/Phoenix-Logo-2014/Phoenix-logo-2014_smaller.tmb.ashx?width=150&height=150&decreaseOnly=true]http://www.phoenixbs.com/ Abu Dhabi | Chicago | London | New York | Sydney From: Andrew Fawcett [mailto:[email protected]] Please make sure you are using v1.20 and also your generated test class code (shown on the Manage Child Trigger page) has call to "dlrs.RollupService.testHandler" it. If it does not, please go back to your Sandbox, click Manage Child Triggers, then allow it to remove the trigger and test classes, then re-deploy it (by clicking Deploy on the same page), this will generate a new style test class. This new style test class will give you more information as to the underlying issue causing the code coverage, which is likely that the child objects require more test data to be passed to them in the test code. — Phoenix Business Solutions Ltd. |
Yes a copy and paste and save will do it. Though you should be able to re-generate the test code via Manage Child Trigger page OK in Sandbox, where the platform doesn't run the tests automatically. Have you tried that? |
Yup, that's where I'm picking up the code from. It won't allow me to make changes to the live org meta data if I copy, paste and save (using the dev console). Any ideas for getting around this? Have tried all of your previous suggested steps in Sandbox.
If I can get the testhandler into live least then I might be able to get a better error when I manually deploy at least. Everything including removing and re-generating the triggers in the sandbox works perfectly. Our sandbox is a full sandbox, and is about a month old, so no major differences. |
Yes, getting the testhandler version of the test into live will get you a better error thats the use case it was designed to help with. Can you issue a Change Set with it? That's the other way of doing this, promote the trigger and test for DLRS via a Change Set, then all you do is define the rollup and tick active checkbox, you don't need to use Manage Child Trigger in production so long as the trigger gets in one way or another. |
I've recently written up some shared details on the code coverage issue described in this case, please check the details here and comment at the bottom of the wiki page. |
Thanks. Have tried change sets with no joy, even trying to update the older ones. Will see if I can bang together some code to get it through referencing some samples. Otherwise will have to find another option in the interim. |
@sharoncannon how did you get on? |
I've marked this as an enhancement, as i am at least going to provide a better means to customise the generated test code without having to jump through hoops with Developer Console etc. My idea is to allow a Text Area field on the Rollup itself to allow the user to paste code that will override the generated test code. This will be used by Manage Child Rollup page and of course will get migrated along with the rest of the rollup config to production or other orgs. So keeps things in one place basically. I know this doesn't resolve the core issue, but i hope will ease the pain of sorting these type of issues. |
Hi, I managed to get my opportunity one to have ironically 100% code coverage, but then it stopped working and starting complaining due to the opportunity validation rules. I’ll keep you updated, but thanks for your help the other day. Cheers Sharon Cannon | Global PMO Manager [http://www.phoenixbs.com/Libraries/Phoenix-Logo-2014/Phoenix-logo-2014_smaller.tmb.ashx?width=150&height=150&decreaseOnly=true]http://www.phoenixbs.com/ Abu Dhabi | Chicago | London | New York | Sydney From: Andrew Fawcett [mailto:[email protected]] @sharoncannonhttps://github.com/sharoncannon how did you get on? — Phoenix Business Solutions Ltd. |
Sure no problem, enjoy your holiday! 👍 |
v1.21 includes a Test Code field to make it easier to apply custom test code. I'll close this enhancement now, but happy to keep chatting here if you need more help with the test code. |
Oh ment to say have added a new field 'Test Code' which will, as i proposed above, allow you to paste in alternative code for the tool to use when deploying tests. This avoids the need to manually edit outside the tool via Developer Console. You can also keep the alternative test code in the same place as the rollup definition, so easier to manage. |
I'm relatively new to all of this, but had no issues following the steps through and deploying in our sandbox. I've now gone to manually go through the process again in our production org and for some reason the apex trigger just will not deploy - it's for opportunities. We have other triggers in place working already.
I get a message saying it's deployed, and then to "deploy it". No error messages saying it can't deploy.
I've double checked that an existing trigger of this name does not exist, and also checked that it's not showing under Apex triggers - I can see our pre-existing ones.
Any suggestions gratefully received as I need this to urgently resolve some financial roll-ups.
The text was updated successfully, but these errors were encountered: