UPDATE: New Tool Available (January 2018)
I’ve developed a new, more robust tool, Mass Action Scheduler, that lets you declaratively schedule Process Builder, Flows, Quick Actions, Email Alerts, Workflow Rules, and Apex to process records from Reports and List Views.
This post is inspired by Tammie Silber’s question on the Success Community if it was possible to have new contacts automatically added to her campaign based on a daily report she had scheduled to save her precious time each day.
“But wait”, you say, “there’s already an ‘Add to Campaign‘ button on Contact and Lead reports.”
You are correct, there is such a button — if you want to manually add contacts and leads to your campaigns… And if you are interested in manual solutions, check out Johan Yu’s blog post Multiple Ways to Add People to Campaign.
But what if I told you you could automate the process to add contacts to your campaigns that meet your report criteria? What if I told you that report can run on a schedule, say daily, and add any new records in the report to your campaign?
This turns out to be a great use case for the Report Notifications features introduced in the Spring ’15 release. This package uses the Apex Analytics API to automate adding
contacts from a report as campaign members using report subscription notifications.
Why Use a Report?
Rather than write apex code with the specific SOQL query criteria in it and which would require redeployments or complex rules engine created to be dynamic anytime the business logic needed to change, we can leverage all the power of Salesforce reports out-of-the-box to narrow down to our desired contacts to add to the campaign. We can even leverage advanced reporting techniques like cross-object filtering or date range filters!
This is awesome because it keeps the control clearly in the administrator’s hands using declarative tools he or she is very familiar with. An added benefit of using the report subscription is that this feature can just as easily be disabled at the click of a button if the administrator ever wants to turn it off. With apex triggers, a redeployment would be necessary… yuck!

Speaking of flexibility, this package does utilize a custom setting to control which campaign a report should add contacts to as new members. How it works is when the apex code is triggered by the report subscription then it looks up the associated Campaign ID by finding the custom setting instance whose Name
value equals the Report ID. This keeps maintenance clean and declarative, and supports as many reports and campaigns as you want =)
Getting Started
1) Deploy these customizations to your sandbox or developer org to test out first. You can easily install these components to your org as an unmanaged package. See my github readme for the most up-to-date package URLs.
2) Create a Contact or Lead report in Tabular
format. Summary
, Matrix
or other complex report formats are not supported by this package at this time. **Technically, you should be able to report on any object so long as at least one of the columns refers to a Contact or Lead field. For example, you could create an “Opportunity with Contact Roles” report to have those contacts added to campaigns.
3) Create a Campaign that you want the contacts or leads from the report to be added to as members whenever the report runs.
4) Go to Setup | Develop | Custom Settings and click Manage
link next to Add Contact to Campaign Report Settings.
5) Click New
button to add a new custom setting entry. Specify the 15 character Report ID from step 2 in the Name
field then specify the 15 character Campaign ID from step 3 in the Campaign ID
field. The simplest way to obtain these values is to go to the report page and campaign detail page, respectively, and copy the ID from the end of the URLs.
6) Go back and run your report from step 2. On the report results page, click on the Subscribe
button. It should appear just after the Add to Campaign
button. Ironically enough, this solution has nothing to do with the Add to Campaign
button — though you’re welcome to use that button to manually add contacts to your campaigns. But if you’re still interested in automating the process, keep reading because you’re almost done!
7) On the Report Subscription page, this is where you request how often you want your Contact or Lead report to run (e.g. weekdays at 3am) and when you want to be notified (e.g. when record count is greater than zero) and then how you want to be notified when those conditions are met (e.g. chatter post, email, execute a custom action). You can choose as many notification actions you want, but for our usage you must minimally choose Execute a Custom Action
and select the apex class AddContactsToCampaignReportAction.
8) To test the subscription, click the Save & Run Now button. If successful then your campaign should now include all the contacts from the report.
Automate Adding Leads to Campaigns
Despite that this post’s title and the code references say “Adding Contacts to Campaigns” this solution also supports Lead reports. You follow all the same instructions as outlined above, just know that the report you use can include Lead and/or Contact fields and work fine.
Acknowledgements
Many thanks to Peter Knolle’s examples on Salesforce Stack Exchange to help me get started learning this API quick!
Kudos to Andy Fawcett and Dominick Medley for figuring out how to construct Reports.EvaluatedCondition object so that I could write the apex unit tests!
Thanks to Shaun Simpkins and Marta Wyszynska for QA and feature ideas!
This looks fantastic! Thank you so much! It will be real life saver for me. I am getting an error whenever I try to run my report
An unexpected error occured. Error message:
This report will no longer be checked for notifications. You can activate the notification in the Report Subscription page.
Any thoughts?
LikeLiked by 1 person
So you can’t run the report at all or do you only get that error when trying to subscribe to it? Can you provide some screen shots?
Maybe double check the Custom Setting is configured and that your profile (or permission set) has access to the apex class?
LikeLike
I can run the report fine. I double checked permissions (I am a full sys admin) and I definitely have permissions. The report is tabular. The report contains Contact ID. When I subscribe, something in apex is returning an error.
Screenshots here. Thank you so much!
https://www.dropbox.com/sh/xaoox5x7xygpacy/AAAG0RtcKF7sQldpFIpisC0Da?dl=0
LikeLiked by 1 person
Hi Scott,
The screen shots look good. To dig deeper, could you grab a debug log when running the report subscription? That may provide more details where the code is failing.
Shooting in the dark here, and I can’t see why it would matter, but is the campaign “active”? How many members already exist in the campaign?
LikeLike
AHHHH – the debug log. Ugh. Why didn’t I think of that. There was one field in my report that would not cooperate. I deleted fields one by one until it worked. (it was the currency field). I’ll play with it a bit. Thank you so much! This solution is brilliant
LikeLiked by 1 person
Glad you figured it out! Thanks for the kind words 🙂
I will go test with currency fields too, I wonder why they blew it up.
LikeLike
I just tried to install the package and received the error below. Any thoughts on how I can get this to work? It would be great to be able to use it.
—————————————————————————————————————————————————————————————
Deployment Started
Status: Queued
Status: InProgress
Status: InProgress
Status: InProgress
Status: InProgress
Status: InProgress
Status: Completed
Deployment CompleteTest failure, method: AddContactsToCampaignReportServiceTest.test_require_custom_setting — System.ListException: List index out of bounds: 0 stack Class.AddContactsToCampaignReportServiceTest.test_require_custom_setting: line 12, column 1
Code coverage issue — Average test coverage across all Apex Classes and Triggers is 0%, at least 75% test coverage is required.
src
src/package.xml
src/classes
src/classes/AddContactsToCampaignReportAction.cls
src/classes/AddContactsToCampaignReportAction.cls-meta.xml
src/classes/AddContactsToCampaignReportService.cls
src/classes/AddContactsToCampaignReportService.cls-meta.xml
src/classes/AddContactsToCampaignReportServiceTest.cls
src/classes/AddContactsToCampaignReportServiceTest.cls-meta.xml
src/objects
src/objects/AddContactsToCampaignReportSettings__c.object
LikeLiked by 1 person
Hi Susan,
Thanks for reporting the issue. I was able to reproduce it in my developer org. I’ve rewritten the apex tests and updated the github project. I successfully was able to deploy it into a developer org now. Please try again and let me know if you continue to run into any issues.
Thanks
LikeLike
Hi Doug,
Thanks so much for looking into this. The installation no longer gives an error (see below) but it doesn’t look like it installed correctly. When I go to Setup/Develop/Custom Settings I don’t see anything called “Add Contact to Campaign Report Setting”. I also looked at the list of Installed Packages and don’t see it.
I’m setting this up for a friend and it is a “nice to have” but not a “must have”.
Thanks.
Susan
————————————————————————————————————————————————————————–
Deployment Started
Status: Queued
Status: InProgress
Status: InProgress
Status: InProgress
Status: InProgress
Status: Completed
Deployment CompleteTest failure, method: AddContactsToCampaignReportActionTest.test_action — AddContactsToCampaignReportService.AddContactsToCampaignReportException: No Campaign ID could be determined for Report ID 00O240000048f4I. Please add an entry to the AddContactsToCampaignReportSettings__c custom setting. stack Class.AddContactsToCampaignReportService.getCampaignId: line 118, column 1
Class.AddContactsToCampaignReportService.execute: line 11, column 1
Class.AddContactsToCampaignReportService.execute: line 4, column 1
Class.AddContactsToCampaignReportAction.execute: line 16, column 1
Class.AddContactsToCampaignReportActionTest.test_action: line 57, column 1
Code coverage issue — Average test coverage across all Apex Classes and Triggers is 68%, at least 75% test coverage is required.
src
src/package.xml
src/classes
src/classes/AddContactsToCampaignReportAction.cls
src/classes/AddContactsToCampaignReportAction.cls-meta.xml
src/classes/AddContactsToCampaignReportActionTest.cls
src/classes/AddContactsToCampaignReportActionTest.cls-meta.xml
src/classes/AddContactsToCampaignReportService.cls
src/classes/AddContactsToCampaignReportService.cls-meta.xml
src/classes/AddContactsToCampaignReportServiceTest.cls
src/classes/AddContactsToCampaignReportServiceTest.cls-meta.xml
src/objects
src/objects/AddContactsToCampaignReportSettings__c.object
src/reports
src/reports/unfiled$public
src/reports/unfiled$public/Add_Contacts_to_Campaign_Report_Test.report
LikeLiked by 1 person
Hi Susan,
Sorry you ran into issues trying to install these customizations. To make the installation process easier, I’ve created a formal unmanaged package. Please refer to this page for the links for production and sandbox: https://github.com/DouglasCAyers/sfdc-add-contacts-to-campaign-report-service/#installation
Thanks!
Doug
LikeLike
Hi Susan,
Thought you might be interested to know that I now provide a managed package installation option so you can avoid these unit test woes.
Thanks for your feedback on the project!
Doug
LikeLike
Hi Doug,
Many thanks for this great feature, it will be very helpful for us.
I have the same issue as Susan when deploying to production.
I created the “Add Contact to Campaign Report Settings” custom settings before deploying but the error is still the same.
Deployment CompleteTest failure, method: AddContactsToCampaignReportActionTest.test_action — AddContactsToCampaignReportService.AddContactsToCampaignReportException: No Campaign ID could be determined for Report ID 00Ob0000004IH6z. Please add an entry to the AddContactsToCampaignReportSettings__c custom setting. stack Class.AddContactsToCampaignReportService.getCampaignId: line 118, column 1
Class.AddContactsToCampaignReportService.execute: line 11, column 1
Class.AddContactsToCampaignReportService.execute: line 4, column 1
Class.AddContactsToCampaignReportAction.execute: line 16, column 1
Class.AddContactsToCampaignReportActionTest.test_action: line 57, column 1
LikeLiked by 1 person
Hi Vincent,
Does the test report also already exist? Even though I include the test report in github and deployed with the code the deployment might be expecting the report to already exist?
After making the last change for Susan, I’ve not had issues with deployment. I’m not too sure what could be holding it up. The error message says the test could not find a campaign for the report id – please double check that the custom setting is configured correctly and that you are using the 15 character IDs.
Thanks,
Doug
LikeLike
Hi Doug,
I managed to deploy in production after creating the test report and a test campaign manually. I can start playing now !
For your information, we will use your solution for a business process that involves the connector between Sales Cloud and Marketing Cloud.
Kind regards,
Vincent
LikeLiked by 1 person
Hi Vincent,
Glad you got this working 🙂 Has this been useful in integrating with Marketing Cloud? Any more issues you’ve run into?
Doug
LikeLike
Hi Vincent,
Sorry you ran into issues trying to install these customizations. To make the installation process easier, I’ve created a formal unmanaged package. Please refer to this page for the links for production and sandbox: https://github.com/DouglasCAyers/sfdc-add-contacts-to-campaign-report-service/#installation
Thanks!
Doug
LikeLike
Hi Vincent,
Thought you might be interested to know that I now provide a managed package installation option so you can avoid these unit test woes.
Thanks for your feedback on the project!
Doug
LikeLike
Hi Doug,
This tool looks great! I’m just curious if there are limitations on the number of contacts that can be added from each report?
Thanks,
Damian.
LikeLike
Hi Damian,
Thanks for the kind feedback! Honestly, I’m not sure the record limitation. The code does insert campaign members in batches of 200. The max DML limit is 150 operations I think. So 150 * 200 = 30,000. If that’s right then your report could have lots of contacts and still be added. How many do you anticipate in your report?
Good thing is that if you did hit a limit then schedule multiple reports that each have filtered to fewer records at a time but configure each report action to add members to the same campaign.
I’d like to know how it turns out for you!
Doug
LikeLike
Hi Damian,
I’ve developed a new and improved solution for supporting more than 2,000 records in a report and using Scheduled Jobs to get around the 5 report subscription limit.
Please try this out: https://douglascayers.com/2017/01/22/automate-adding-campaign-members-via-reports/
Thanks,
Doug
LikeLike
Wow this is a great thing to know about, wish I would found it sooner. I do have a question for you; Would this work from an Opportunity with Contacts Roles report to have the Contacts added to specific campaigns?
LikeLiked by 1 person
Hi Bill,
Great question! And the answer is YES. I just made an update tonight that should allow any tabular format report to work so long as at least one of the columns is a Contact field. I did a test specifically with “Opportunity with Contact Roles” and worked like a charm.
To make the installation process easier, I’ve created a formal unmanaged package. Please refer to this page for the links for production and sandbox: https://github.com/DouglasCAyers/sfdc-add-contacts-to-campaign-report-service/#installation
Thanks!
Doug
LikeLike
@Doug Ayers, I think this will be a lifesaver, but I had trouble deploying into our instance because we use campaign record types and Saleforce rejects it. Is there a way to clone your code and add a campaign record type on lines 27 and 44?
Full error message below:
Deployment CompleteTest failure, method: AddContactsToCampaignReportActionTest.test_action — System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Campaign: [] stack Class.AddContactsToCampaignReportActionTest.test_action: line 44, column 1 Test failure, method: AddContactsToCampaignReportServiceTest.test_service — System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Campaign: [] stack Class.AddContactsToCampaignReportServiceTest.test_service: line 27, column 1
LikeLiked by 1 person
Hi Katherine,
Yes, you can modify the code before deploying to production. My recommendation is to deploy this first into your sandbox using the “Deploy from Github” link on the installation page then in your sandbox modify the test class accordingly to set an expected record type (and any other required fields in your org to pass validation rules). Once the test is passing in your sandbox, use a change set to deploy the related classes to your production org.
For example, in the
AddContactsToCampaignReportServiceTest
class, you might modify lines 22-25 that prepares the Campaign record to specify other fields:You would do the same thing in the
AddContactsToCampaignReportActionTest
class and modify lines 39-42.Thanks,
Doug
LikeLike
Hi Katherine,
Thought you might be interested to know that I now provide a managed package installation option so you can avoid these unit test woes.
Thanks for your feedback on the project!
Doug
LikeLike
Hi Doug, this is almost exactly what I need, but in my case, I need the campaign to reset to 0 before importing new contacts, I’m not an apex developer, is there a quick function so that I can remove all campaign members before executing the import?
LikeLiked by 1 person
Hi David,
Interesting use case. This should be able to be done, I’ve added this feature request to the GitHub issue list.
I haven’t tested this yet, but if you wanted a quick proof-of-concept, then I recommend editing the AddContactsToCampaignReportService.cls just after line 14 to do something akin to:
delete [ SELECT id FROM CampaignMember WHERE campaignId = :campaignId ];
Thanks,
Doug
LikeLike
Thanks Doug! I’ll try that out. I want to market to a specific group of contacts while their opportunity information matches certain criteria, and I think this will do it!
LikeLiked by 1 person
It works! Thank you!
LikeLiked by 1 person
Woo hoo!
LikeLike
Hi Doug – thanks for the script its working great but seems to be capped at 2000 records? I can see from your post here https://douglascayers.wordpress.com/2015/07/06/salesforce-automate-adding-contacts-to-campaign-via-report-subscription/#comment-202 that you estimate it to be 30,000 but we have a report of 2020 but there is only every 2000 records end up in the campaign – any ideas? But thanks for the script though!
LikeLiked by 1 person
PS it seems we are getting Apex time limit exceeded in the logs – still investigating and the total number of report records is only about 2500 ish
LikeLiked by 1 person
Sorry for the comment bomb you can probably delete all other comments but this is relevant – Reporting API is capped at 2000 records – http://salesforce.stackexchange.com/questions/120236/how-can-i-get-a-report-to-return-more-than-2-000-rows-using-the-reportresults/120238
LikeLiked by 1 person
Hi Steve,
Yes, the 2,000 record max limit is an Analytics API limit:
https://developer.salesforce.com/forums/?id=906F0000000BKDaIAO
https://developer.salesforce.com/releases/release/related/AnalyticsAPI
LikeLike
The scheduled report is timing out and it seems like its trying to read every col as an ID? 13:45:53:260 USER_DEBUG [97]|WARN|Report cell value is not parseable as an ID: Reports.ReportDataCell[label=Owner, value=Owner]
LikeLiked by 1 person
Hi Steve,
The code does iterate over all the columns. That is an expected warning message from the code for troubleshooting purposes. It is not an error. When the code parses the data if the value is not an ID then it is skipped, but I log it so I could understand what columns were breaking the code before I had the fix in place.
Thanks,
Doug
LikeLike
I love this!
LikeLiked by 1 person
Thanks, Kristin!
LikeLike
Hi Doug,
I’ve currently got 5 of these setup to automatically add 5 reports to 5 campaigns. I love it. I’m wondering if there is a limit to the number of automations we can have in place. I ask because I am setting up a 6th automation from report to campaign, and on this 6th report the ‘subscribe’ button is visible but not usable. Have you encountered this before? Basically the Subscribe button is gray and un-clickable.
I still love this setup either way, just wondering if I’ve encountered something new!! Cheers, Doug.
LikeLiked by 1 person
After hovering over the button I see that it says I have reached the limit, are there intentions to allow more than 5 or is there a workaround I could put in place?
LikeLiked by 1 person
Hi Steven,
Glad you like this solution! You are correct, Salesforce has a hard limit of 5 report subscriptions per user at this time, unfortunately.
A potential workaround, depending on the complexity of your criteria to choose which contacts or leads should be added to the campaign could be to use Process Builder and/or Flow. Process Builder could be fired when a contact meets your criteria then as your action create a Campaign Member record.
Another option may be to use my Process Builder Scheduler to launch a Flow on a periodic schedule, like every hour or daily or monthly, and the Flow queries for Contacts or Leads that meet your criteria then create Campaign Members that way. It’s on my todo list to write up a blog post for this alternative scenario.
Thanks,
Doug
LikeLiked by 1 person
Hi Steven,
I’ve developed a new and improved solution for supporting more than 2,000 records in a report and using Scheduled Jobs to get around the 5 report subscription limit.
Please try this out: https://douglascayers.com/2017/01/22/automate-adding-campaign-members-via-reports/
Thanks,
Doug
LikeLike
Please vote this idea up to help us get the limitation of 5 subscription reports increased.
https://success.salesforce.com/ideaView?id=08730000000DkodAAC
LikeLiked by 1 person
Hi rodneyaz,
I’ve developed a new and improved solution for supporting more than 2,000 records in a report and using Scheduled Jobs to get around the 5 report subscription limit.
Please try this out: https://douglascayers.com/2017/01/22/automate-adding-campaign-members-via-reports/
Thanks,
Doug
LikeLike
Hi Doug – will this solution work for custom report types?
LikeLiked by 1 person
I believe so yes. It simply needs a Contact ID or Lead ID column value in the report. The code does not restrict by report type other than the display format must be Tabular (no summary or matrix reports).
LikeLike
Douglas, I have installed your package in the sandbox and it worked with no problem, then I Installed it in production, and it is not adding the campaign members. No sure what is the issue. I followed all the steps, as I did in the sandbox and what you have in your document. What could be the issue? Please let me know. Thank you.
LikeLiked by 1 person
Hi Kim,
Off the top of my head, things to look at are the Custom Setting. Does it have the correct Report ID and Campaign ID in your production org?
When you setup the Report Subscription in production, did it give you any errors? When the report runs are there any records that come back?
Can you share screenshots of your Report Subscription and Custom Setting config using http://www.screencast.com?
Thanks,
Doug
LikeLike
Hi Doug,
I have followed your instructions step by step. However… Only 2,000 contacts out of 10,311 have made it into my Campaign. Could you please help me figure out why?
Thank you,
Celine
LikeLiked by 1 person
Hi Celine,
Yes, I know exactly what you’re referring to. I need to update the code to query for the next page of records. I know what to do, been doing it in recent projects, just hadn’t come back to this one yet.
Will update you once I get this updated now that you’ve reminded me!
Thanks,
Doug
LikeLike
Hi Celine,
I’ve developed a new and improved solution for supporting more than 2,000 records. Please try this out: https://douglascayers.com/2017/01/22/automate-adding-campaign-members-via-reports/
Thanks,
Doug
LikeLike
I’m trying to install this into my account (which at one time had the NPSP Nonprofit Service Pack) installed, and I’m getting this error message:
Deployment CompleteTest failure, method: NPSP_ReportServiceTest.testReportIterator — System.AssertException: Assertion Failed: Expected: {001A000001D5BacIAF, 001A000001D5BadIAF, 001A000001D5BaeIAF, 001A000001D5BafIAF, 001A000001D5BagIAF, 001A000001D5BahIAF, 001A000001D5BaiIAF, 001A000001D5BajIAF, 001A000001D5BakIAF, 001A000001D5BalIAF, …}, Actual: {001A000001D5BacIAF, 001A000001D5BadIAF, 001A000001D5BaeIAF, 001A000001D5BafIAF, 001A000001D5BagIAF, 001A000001D5BahIAF, 001A000001D5BaiIAF, 001A000001D5BajIAF, 001A000001D5BakIAF, 001A000001D5BalIAF, …} stack Class.NPSP_ReportServiceTest.testReportIterator: line 106, column 1
LikeLiked by 1 person
Hi Yonatan,
I just put the new code together last night. The unit tests unfortunately have to run with seeing all data in the org. It’s likely the test report I included, “NPSP Test Account Report”, is returning different number of accounts.
I’m assuming you installed this in your sandbox the running the unit tests? How many accounts show in that report when you view it in your sandbox?
Thanks
LikeLike
To confirm, you’re trying the new code from this repository, correct? https://github.com/DouglasCAyers/sfdc-add-campaign-members-by-report
LikeLike
Hi Yonatan,
I’ve developed a new and improved solution. Please try this out: https://douglascayers.com/2017/01/22/automate-adding-campaign-members-via-reports/
Thanks,
Doug
LikeLike
Thanks Douglas. That seemed to work, but now I’m getting a different error and still don’t see the reports within SF:
Deployment CompleteCode coverage issue — Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required.
LikeLiked by 1 person
Interesting that the report folders aren’t deploying. It worked in my new dev org. Can you confirm if Enhanced Sharing for Reports and Dashboards is enabled in your org? I wonder if that might be causing any issues.
If all else fails, try creating these two report folders manually:
1. Add_Campaign_Members_By_Reports
2. NPSP_Test_Reports
Doug
LikeLike
Hi Yonatan,
Thought you might be interested to know that I now provide a managed package installation option so you can avoid these unit test woes.
Thanks for your feedback on the project!
Doug
LikeLike
I tried both suggestions, but am still receiving the same message.
LikeLiked by 1 person
Do you see any other error messages? Do the unit tests miss required fields in your org?
LikeLike
No, this is the only message that I receive:
…
Status: InProgress
Status: Completed
Deployment CompleteCode coverage issue — Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required.
LikeLiked by 1 person
Hi Yonatan,
In your sandbox, could you run the unit tests there and see if they provide any more detailed error messages?
I’ve deployed this to multiple dev, sandbox, and prod orgs so right now we are trying to figure out what in your org may be holding things up.
Thanks,
Doug
>
LikeLike
Hi Doug,
I am struggling to get your new version working. When i click deploy, I get this error message:
Deployment CompleteTest failure, method:
AddContactsToCampaignReportActionTest.test_action — System.SObjectException: Invalid field RecordTypeId for GW_Volunteers__Volunteer_Shift__c stack Class.dupcheck.dc3Helper.isRecordTypeEnabled: line 1135, column 1
Class.dupcheck.dc3Meta.builtMeta: line 151, column 1
Class.dupcheck.dc3Meta.getObjectMeta: line 209, column 1
Class.dupcheck.dc3Meta.getRecordTypeList: line 237, column 1
Class.dupcheck.dc3Config.getRecordTypeConfig: line 312, column 1
Class.dupcheck.dc3Config.getRecordType: line 361, column 1
Class.dupcheck.dc3Config.getScenariosByFeature: line 501, column 1
Class.dupcheck.dc3Search.searchWithConfig: line 127, column 1
Class.dupcheck.dc3Search.searchWithConfig: line 263, column 1
Class.dupcheck.dc3Search.searchWithConfig: line 8, column 1
Class.dupcheck.dc3Trigger.processTrigger: line 333, column 1
Trigger.dupcheck.dc3AccountTrigger: line 4, column 1
Test failure, method: AddContactsToCampaignReportServiceTest.test_service — System.TypeException: Collection store exception putting Boolean into Map stack Class.reports.ReportDetailRow.getStringRepMapVisibleProperties: line 79, column 1
Class.reports.ReportDetailRow.toString: line 54, column 1
Class.AddContactsToCampaignReportService.getNewContactAndLeadIdsToAddToCampaign: line 73, column 1
Class.AddContactsToCampaignReportService.execute: line 21, column 1
Class.AddContactsToCampaignReportServiceTest.test_service: line 50, column 1
Any advice on what I can do?
Thank you
Celine
LikeLiked by 1 person
Hi Celine,
Sorry you’re having issues. Please try installing my managed package option instead of deploying from github directly (same code and config, but in managed package to avoid these errors).
The current install link is on the projects readme page: https://github.com/DouglasCAyers/sfdc-add-campaign-members-by-report/blob/master/README.md#installation
LikeLike
Hi Doug.
I deployed the managed package and that went fine. I followed your steps but the contacts are just not showing up in my campaigns…
Thanks,
Celine
LikeLiked by 1 person
Hi Celine,
I suspect there might be some errors occurring when the Campaign Member records are being created. As the System Administrator, have you received any Apex error emails? You might also need to check the Debug Logs generated at the time this job runs to see if anything pertinent is mentioned there.
To receive Apex error emails, navigate to Setup | Email Administration | Apex Exception Email. On that page click button Add Salesforce User and choose yourself.
To check the Debug Logs, open the Developer Console before testing the report action that will try to add the contacts to the campaign. This will begin a monitoring session automatically so that you can access the logs generated by the code when it does run. Next, navigate to your report, click the “Edit Subscription” button, click the “Save & Run Now” button.
http://womencodeheroes.com/2015/11/salesforce-developer-console-quick-start-guide/
Doug
LikeLike
Hi Celine,
Just to confirm, are you using my new solution I wrote about here?
Thanks,
Doug
LikeLike
Hi doug,
i have been using this fix for awhile now and it’s been working fine. But, i recently just discovered that for some reason, the “subscribe” button on my report is grayed out. Any idea why this is happening?
LikeLiked by 1 person
Hi Megan,
Not sure off the top of my head. Have you reached your max of 5 report subscriptions? Could you provide a link to screen shot of your report criteria and the greyed out button?
Thanks,
Doug
LikeLike
Megan, I just realized this post is my old solution. Have you tried the new package I wrote about here?
LikeLike