Skip to content
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 Apex Trigger for Campaign Member #356

Closed
StephanieKing opened this issue Jul 18, 2016 · 14 comments
Closed

Error Deploying Apex Trigger for Campaign Member #356

StephanieKing opened this issue Jul 18, 2016 · 14 comments

Comments

@StephanieKing
Copy link

Any ideas what to do with this Failed Trigger Deployment? I've tried it a few times with no luck...

dlrs_CampaignMemberTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: MALFORMED_ID, Invalid campaign id: null: [CampaignId] Class.dlrs.RollupService.testHandler: line 277, column 1 Class.dlrs_CampaignMemberTest.testTrigger: line 11, column 1

Warning:
dlrs_CampaignMemberTrigger:Test coverage of selected Apex Trigger is 0%, at least 75% test coverage is required

@aheber
Copy link
Contributor

aheber commented Jul 19, 2016

@StephanieKing I just ran into this exact same problem. You'll need to deploy a custom test method to make this work. In the Advanced section of edit page, you'll find the Test Code field. Put this into that box and try to redeploy.

        Campaign camp = new Campaign(Name = 'Test Campaign');
        Insert camp;
        Contact c = new Contact(LastName = 'Test');
        Insert c;

        dlrs.RollupService.testHandler(new CampaignMember(CampaignId = camp.Id, ContactId = c.Id));

@afawcett
Copy link
Collaborator

Yep thanks @aheber thats trick! 👍

@StephanieKing
Copy link
Author

Thank you!

@gurudave08
Copy link

Great tip, thanks @aheber! I'm running into the same issue. But I do not see a "Test Code" text box in the Advanced section. Just a checkbox that says "Test Code See All Data". Do I need to update to a new version?

@afawcett
Copy link
Collaborator

Check your on the latest version yes, if you are and your using the Custom Object based rollups (e.g. not the Manage Rollup Summaries which uses Custom Metadata) then ensure its on the layout (as these don't upgrade).

@gurudave08
Copy link

Thank you @afawcett. Sorry for the newb question but how do I go about updating the app?

@afawcett
Copy link
Collaborator

No worries, just repeat the process you followed to install the package (see links in the README) you did before and the system automatically detects its an upgrade. Depending on the version your going from you may need to add some fields to layouts (these are not upgraded, see readme versions section and notes for each), though if your using the Manage Rollups page this does not apply.

@gurudave08
Copy link

got it. works perfectly now. Thanks Andy, you rock!

@creuman
Copy link

creuman commented Sep 9, 2016

Thank you @aheber for the test code!

@olgaloza
Copy link

olgaloza commented Oct 5, 2017

I have the same problem but we use Person Accounts. I get the following error:

Error: dlrs_CampaignMemberTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please do not create Contact records. Use Person Accounts instead.: [] Class.dlrs_CampaignMemberTest.testTrigger: line 13, column 1

How would this code need to change?
Thank you!

@chazzvader
Copy link

Thank you!

@StephanieKing
Copy link
Author

@afawcett well here I am again... this is my post from 2016, and apparently I was able to fix this issue with the code above, but this time I don't understand at all where I am supposed to paste the code? What is the Advanced section of the Edit page?? Hoo boy....
I am using the latest version, and I am using the "manage rollups" page...

@rogeramitchell
Copy link
Contributor

@StephanieKing if you are on the Manage Lookup Rollup Summaries tab, there is an Advanced section at the bottom with a Test Code box. Paste the code there and click Save.

@StephanieKing
Copy link
Author

@rogeramitchell oh gee, there it is. Much appreciated, sir!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants