-
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
Error deploying Child Trigger on NPSP object npe03_Recurring_Donation #490
Comments
Yes you need to provide some custom test code in the Test Code field, i am not an expert in NPSP, hopefully someone in the Chatter group has the test code fragment you need. Meanwhile this is the background to both your errors https://github.com/afawcett/declarative-lookup-rollup-summaries/wiki/Challenges-with-Code-Coverage |
@RWAPS Did you ever manage to solve your test code issue? I just wrote test code for a trigger that rolls up recurring donations to the contact record and if you're trying to do something similar then I'd imagine my test code will work for you. I believe I received the same error as you did in my first go round--it's because there's a validation rule on the Recurring Donation object to assign either a contact or an organization. You can do that in your test code like this (my test code also needed the custom field 'Inactive_Recurring_Gift__c' to be false):
Just a final bit--if you have other validation rules on the contact object, then you need to turn them off to get this to work (we had a validation where you needed to enter a first time that I turned off to get it to pass the tests and deploy). |
Hi @benchastain, thanks, yes I did manage to solve this. Thanks for the additional information. |
Thanks for sharing @benchastain, i dont have NPSP experience so depend on this kind of contribution from the community to help others. Thank you! 👍 |
I could use some assistance on this same item except I am trying to roll up the GAU Allocations to the Opportunity record. We are recording the GAU Allocations on through a lookup on the opportunity and upon save this creates the Allocation records. But I need to verify the allocation totals equal the opportunity total. Any assistance would be greatly appreciated. |
@benchastain I wasn't able to use your code directly (it gave an error) but the following worked
|
I believe I originally wrote that code over a year ago and was written with some specific parameters for custom fields. If there have been updates to the NPSP or you have additional custom logic in your instance it would make sense that my code was not just a simple copy/paste.
Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From: Alex <[email protected]> Date: 2/15/18 9:43 PM (GMT-05:00) To: afawcett/declarative-lookup-rollup-summaries <[email protected]> Cc: benchastain <[email protected]>, Mention <[email protected]> Subject: Re: [afawcett/declarative-lookup-rollup-summaries] Error deploying Child Trigger on NPSP object npe03_Recurring_Donation (#490)
@benchastain I wasn't able to use your code directly (it gave an error) but the following worked
` Contact con = new Contact(Lastname = 'Test');
insert con;
npe03__Recurring_Donation__c recur = new npe03__Recurring_Donation__c();
recur.npe03__Installment_Period__c = 'Monthly';
recur.npe03__Open_Ended_Status__c = 'Open';
recur.npe03__Schedule_Type__c = 'Multiply By';
recur.npe03__Amount__c = 50;
recur.npe03__Date_Established__c = System.Today();
recur.npe03__Next_Payment_Date__c = System.Today();
recur.npe03__Contact__c = con.Id;
SavePoint sp = Database.setSavepoint();
dlrs.RollupService.testHandler(recur);
Database.rollback(sp);`
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/afawcett/declarative-lookup-rollup-summaries","title":"afawcett/declarative-lookup-rollup-summaries","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/afawcett/declarative-lookup-rollup-summaries"}},"updates":{"snippets":[{"icon":"PERSON","message":"@alexandr-yul in #490: @benchastain I wasn't able to use your code directly (it gave an error) but the following worked\r\n\r\n` Contact con = new Contact(Lastname = 'Test');\r\n insert con;\r\n\r\n npe03__Recurring_Donation__c recur = new npe03__Recurring_Donation__c();\r\n recur.npe03__Installment_Period__c = 'Monthly';\r\n recur.npe03__Open_Ended_Status__c = 'Open';\r\n recur.npe03__Schedule_Type__c = 'Multiply By';\r\n recur.npe03__Amount__c = 50;\r\n recur.npe03__Date_Established__c = System.Today();\r\n recur.npe03__Next_Payment_Date__c = System.Today();\r\n recur.npe03__Contact__c = con.Id;\r\n \r\n SavePoint sp = Database.setSavepoint();\r\n dlrs.RollupService.testHandler(recur);\r\n Database.rollback(sp);`"}],"action":{"name":"View Issue","url":"#490 (comment)"}}}
|
Reminder to include this when delivering this idea, #613. |
I will close this out for now. We can keep chatting though and re-open the case if needed. Thanks! 😄 |
Hello everyone, I've upgraded to V2.8 of DLRS in my sandbox, and some Roll up summaries work fine (using the new flavour with custom metadata, via the "Manage Lookup Rollup Summaries" tab) while others, where the child object is "npe03__Recurring_Donation__c" from the Salesforce Foundation NPSP, fail to deploy.
I get 2 errors, any idea?
Error:
dlrs_npe03_Recurring_DonationTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You must select an Organization or Contact: [] Class.dlrs.RollupService.testHandler: line 272, column 1 Class.dlrs_npe03_Recurring_DonationTest.testTrigger: line 11, column 1
Warning:
dlrs_npe03_Recurring_DonationTrigger:Test coverage of selected Apex Trigger is 0%, at least 75% test coverage is required
My understanding from reading other issues here is that I can solve #2 by adding a custom test class (but where?), and #1 seems to be a recurring issue in relation to DLRS with NPSP (issue #197). Any updates on DLRS with NPSP? Thanks so much!
The text was updated successfully, but these errors were encountered: