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.
Save time and effort and avoid data loads by automatically adding contacts and leads to your campaigns based on reports.
Use reports to segment and filter the leads and contacts that matter to you then use either Report Subscriptions or Scheduled Jobs to automate adding those records to your campaigns.
Wait, this sounds familiar…
Yep, I’ve written about this topic before, but that initial implementation had two major drawbacks:
- The Analytics API only supports up to 2,000 records per report request. Companies with many records in their reports were not getting all of the campaign members added.
- Salesforce limits report subscriptions to 5 per user. So if you had many reports to configure then you were out of luck.
Out with the Old, In with the New
I’ve re-written the solution, available on GitHub, from the ground up to overcome those initial limitations and aim to be more scalable.
Have more than 2,000 campaign members to add? No Problem!
To overcome the 2,000 record limit per report request, I’ve included the SalesforceFoundation‘s ReportService, part of their CampaignTools package, in my solution. You do not need to install the Non-Profit Starter Pack (NPSP), just thank them for making their awesome solutions open source for the community!
Compared to the earlier solution, originally your reports did not explicitly have to have the Contact ID or Lead ID columns on the report (yes that helped, but wasn’t necessary). I would try to infer the record id from any of the columns on the report. In this new solution, your report must include the Contact ID or Lead ID record id field or a lookup to those objects.
Out of Report Subscriptions? Schedule Jobs instead!
To overcome the 5 report subscription limit, I’ve included support for Scheduled Jobs.
You can schedule a job to run periodically that will automatically run the reports for you. It’s about as simple or simpler to do than setting up the report subscription you just need to do it in the Developer Console to run the below snippet:
// schedule job to run at 3am every day
String cron = '0 0 3 * * ?';
System.schedule( 'AddCampaignMembersJob-' + DateTime.now().getTime(), cron, new AddCampaignMembersByReportSchedulable() );
Please consider voting for these ideas to increase the report subscription limit:
- Increase the limit on the number of reports a user can subscribe to
- Increase Report Subscription Notifications
Use different Campaign Member Statuses for each Report
New feature: you can now specify the default campaign member status to use in the custom setting per report + campaign assignment. You can either leave the value blank and leverage Salesforce default behavior or specify your desired value.
Not real-time, but near real-time
For scalability, the campaign members are now added in a batch job in the background rather than in real-time. For small reports (less than 500 records) you may not even notice a difference. For large reports (more than 2,000) records you may see the campaign members be added over a period of seconds or minutes.
Nice Post Doug
LikeLiked by 1 person
Thanks, Nitish!
LikeLiked by 1 person
Hi Doug!
Thanks for this great post! I managed to deploy in sandbox (and it’s a really really good job and great feature!) but not in production.
Got the following error :
Status: Completed
Deployment CompleteTest failure, method: AddCampaignMembersByReportActionTest.test_notification — System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATES_DETECTED, Vous créez un compte en double . Nous vous recommandons d’utiliser un enregistrement existant.: [] stack Class.AddCampaignMembersByReportActionTest.test_notification: line 28, column 1
Test failure, method: AddCampaignMembersByReportBatchableTest.test_batchable — System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATES_DETECTED, Vous créez un compte en double . Nous vous recommandons d’utiliser un enregistrement existant.: [] stack Class.AddCampaignMembersByReportBatchableTest.test_batchable: line 28, column 1
Test failure, method: AddCampaignMembersByReportScheduleTest.test_schedule — AddCampaignMembersByReportBatchable.AddCampaignMembersByReportException: Report with id “00O37000001ookyEAA” is missing expected column label “Contact ID” that references a record id like Contact.Id or Lead.Id stack Class.AddCampaignMembersByReportBatchable.: line 43, column 1
Class.AddCampaignMembersByReportSchedulable.execute: line 15, column 1
Test failure, method: AddCampaignMembersByReportServiceTest.test_add_members — System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Vous ne pouvez pas enregistrer ce Contact sans fournir soit un courriel ou numéro de téléphone.: [] stack Class.AddCampaignMembersByReportServiceTest.test_add_members: line 23, column 1
Test failure, method: IntegrationUtilsTest.TestBatchStagingInstitution — System.AsyncException: Cette tâche Apex nommée “BatchProcessStagingInstitutiton” est déjà planifiée pour l’exécution. stack Class.IntegrationUtilsTest.TestBatchStagingInstitution: line 427, column 1
Test failure, method: IntegrationUtilsTest.TestBatchStagingProfilUtilisateur — System.AsyncException: Cette tâche Apex nommée “BatchProcessStagingUserProfile” est déjà planifiée pour l’exécution. stack Class.IntegrationUtilsTest.TestBatchStagingProfilUtilisateur: line 435, column 1
I understand that the test is trying to create duplicates and also that it tries to run some custom batch that I already have.
Any idea to solve it? Thanks!
LikeLiked by 1 person
Hi Peter,
Thanks for the kind feedback!
Regarding the test failures I think a few things are at play here. But first, know I don’t read French (at least I think that’s French).
One error, FIELD_CUSTOM_VALIDATION_EXCEPTION, indicates there are custom validation rules in your org so the code will need to be updated when it creates Accounts, Contacts, and Leads to satisfy your orgs requirements. You may need another developer to make the changes if you’re not comfortable editing the code yourself.
Another error message, DUPLICATES_DETECTED, makes me think that Duplicate Management Rules are enabled in the org. You may need to change the test code so the data created is considered unique. One of the drawbacks of testing the Analytics API is it has to run with SeeAllData = true otherwise there wouldn’t be any data seen by the test to be considered a duplicate.
The error about IntegrationUtilsTest, that is unrelated to my code. When you deploy to production the default behavior is that all apex tests are run and only if all pass then code is deployed. You will need another developer to analyze that code to fix any failing tests in production before trying to deploy my solution.
Since you’ll need to modify my code for your org, I recommend making the tweaks in your sandbox then using changeset to move the code and config items to production. If you were to use the “Deploy from GitHub” link for production you’ll continue to get these errors unless you disable the validation and duplicate rules temporarily for the deployment.
Hope that helps!
Doug
LikeLike
Hi Doug!
Thank you for your answer. I asked a dev to analyze it and he succeed to deploy your code. He previously disabled our validation rules and programmed tasks.
Right now it works perfectly.
Thank you for this great code!
Peter
LikeLiked by 1 person
That’s great! Glad you all got it deployed. Curious, do your reports have more than 2,000 contacts or leads being added to campaigns? I’m curious if that works well for folks “in the wild” so to speak 🙂
LikeLike
Hi Doug,
It worked with a report containing 7.5K leads however it didn’t work with another one including 15K Contacts.
I didn’t try to find the limit
LikeLiked by 1 person
Thanks for the follow up Peter! If you all dig into the problem with the 15K contacts or have a debug log with any error messages, please open an issue on the GitHub repo here for me to investigate: https://github.com/DouglasCAyers/sfdc-add-campaign-members-by-report/issues/new
Thanks,
Doug
LikeLike
Hi Doug,
Didn’t have time yet to dig into this problem.
However I noticed another one when, as a user, you change your language setting who have for consequence to not run the script any more.
I opened an issue/idea on your github.
Have a nice day!
Peter
LikeLiked by 1 person
Thanks for opening the issue Peter. Good catch!
LikeLike
Hi Peter,
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
Thanks for creating this, Doug. I am having trouble getting it to work with a lookup field, however. I have an Opportunity report, containing a Primary Contact lookup field (we don’t normally use contact roles). The error message I’m getting in the debug log is “Report with id “00OC0000006VsebMAC” is missing expected column label “Primary Contact” that references a record id like Contact.Id or Lead.Id”. The primary contact field is definitely on the report. Any thoughts?
LikeLiked by 1 person
Hi Jennifer,
I haven’t tried that combo before. Let me do some testing and then I’ll follow up.
Doug
LikeLike
Hi Jennifer,
I’ve opened an issue for this on the GitHub project: https://github.com/DouglasCAyers/sfdc-add-campaign-members-by-report/issues/1
I’ve reproduced the problem and think I have a good idea how to fix it. Stay tuned.
Thanks,
Doug
LikeLike
Hi Jennifer,
Good news! That was a quick and easy fix =)
Please update your copy of the code and try again.
Thanks,
Doug
LikeLike
Thanks, for adding that functionality! It did work, partially, when I updated the code. My report is 250+ contacts, but only 56 of them are being added to the campaign. The error message mentions a duplicate: “First error: Insert failed. First exception on row 14; first error: DUPLICATE_VALUE, Attempted to add an entity ‘003C0000021KQmQ’ to a campaign ‘701C0000001DzhU’ more than once.: []”. Any way to overcome that, other than removing the duplicates from the report?
LikeLiked by 1 person
Hi Jennifer,
Glad we are making progress! The code checks for duplicates prior to adding the Campaign Members but I never thought about the report actually containing Contact or Lead IDs multiple times. That too should be a simple fix (safe harbor).
I’ve opened a new issue on the project page to track progress.
Thanks,
Doug
LikeLike
Thanks. In an opportunity report of contacts, avoiding duplicates is nearly impossible, as the same contact may have several sales.
LikeLiked by 1 person
Thanks for the use case and helping improve the project!
LikeLike
Hi Jennifer,
I’m working on feature to handle duplicate record IDs in a report per your use case.
For even better performance for large reports, you may want to create a Contact report and use Cross-Filters to narrow down to those Contacts with Opportunities that meet your criteria. This would ensure a Contact is in the report exactly once.
Video – How to Use Cross Filters in Reports
Documentation – Create a Cross Filter
Documentation – Example Cross Filters
Thanks,
Doug
LikeLike
That’s a great idea, thanks Doug! And thanks for the update.
LikeLiked by 1 person
Hi Jennifer,
Thought you might be interested to know that I now provide a managed package installation option so you can avoid any unit test woes when trying to deploy into your orgs.
Thanks for your feedback on the project!
Doug
LikeLike
Hi Jennifer,
I’ve updated the code to handle duplicate Contact or Lead IDs in the same report. I still recommend trying to avoid those scenarios by using cross-filters when possible.
This new version also supports when users run the reports and their personalized language is not English. This means that any of your existing custom setting values that specified a column label like “Contact ID” actually need to be updated to be the column name like “CONTACT_ID”. Don’t worry, this new version of the app includes a Visualforce page that makes managing these custom settings much simpler. No more copying & pasting campaign or report IDs.
You can get the latest code here: https://github.com/DouglasCAyers/sfdc-add-campaign-members-by-report
Thanks,
Doug
LikeLike
Thanks, Doug, but this is still not working for me. I’m getting the “System.NullPointerException: Attempt to de-reference a null object” error message in the debug log. Not sure what I’m doing wrong.
LikeLiked by 1 person
Sorry to hear that Jennifer!
Would you mind opening an issue on the GitHub project where you can also share the contents of your Debug Log so I can investigate further?
Thanks,
Doug
LikeLike
Hi Doug
Do you have any advice on how to remove the campaign members if they no longer show up on the report?
Thanks
Przemek
LikeLiked by 2 people
Hi Przemek,
I’ve opened a new GitHub issue for this feature request. A couple people have asked for this and it’s now in my backlog. You can follow that issue to be updated once this has been implemented.
In the meantime, you can modify the AddCampaignMembersByReportBatchable at line 51 to add statement like:
delete [ SELECT id FROM CampaignMember WHERE campaignId = :this.campaignId ];
Thanks,
Doug
LikeLiked by 1 person
Hi Doug
I have updated the package and tried to use the workaround suggested but as this is a managed package now, I can’t modify the apex class.
Can you advise any other solution?
Thanks in advance.
Przemek
LikeLiked by 1 person
Hi Przemek,
The source code is still available on GitHub as this is an open source project. You can deploy it into your sandbox from the Installing the Source Code (Developers) section of the project page.
With the unmanaged code you may need to make other tweaks to the unit tests to pass any validation rules in your org.
Then you can deploy the code and config from your sandbox to production via change set.
Doug
LikeLike
Thanks Dough. Unfortunately it doesn’t work when I try to deploy it to sandbox. It says:
Deployment Complete
Failures:
package.xml(AddCampaignMembersByReportSetting__c.All):An object ‘AddCampaignMembersByReportSetting__c.All’ of type ListView was named in package.xml, but was not found in zipped directory
I have tried to deploy it to 2 separate sandboxes and it failed to deploy in both of them. Could you advise? Thanks
LikeLiked by 1 person
Sorry to hear that, Przemek. I’ll take a look and follow up.
LikeLike
Hi Doug
Did you have a chance to look into that? Wondering if I can give it a try again.
Cheers
LikeLiked by 1 person
Hi Przemek,
I’ve just removed the reference of the list view from the package.xml file so this should work now, sorry for the issue.
The technical reason for the issue is:
Seems like this is a bug/limitation of the Metadata API that the list view definition is not being retrieved and so it is literally missing in my GitHub project and hence your error.
When I try to manually include the list view information in the file then I get error on save: “Cannot specify: listViews for CustomSettings”.
Thanks,
Doug
LikeLike
I’ve deployed in sandbox, but it isn’t working. I’m not seeing any errors, I’m just not getting campaign members. Ideas?
LikeLiked by 1 person
Hi Melissa,
To help troubleshoot, would you mind opening a GitHub issue and providing screen shots of your report filter and configuration being used?
Thanks,
Doug
LikeLike
Hi Doug,
Thanks for directing me to this new solution!
I don’t seem to be having the same problem with my “subscribe” button grayed out in the report page. BUT now, when I click on the “Save & Run Now” button, I receive two emails. One says:
An unexpected error occured. Error message:
“There was an unexpected error while running an action for ‘Book Giveaways – leads'”
This report will no longer be checked for notifications. You can activate the notification in the Report Subscription page.
(This email comes first)
And then the second email is a notification that the workflow met the conditions and the contacts/leads were added to the campaign.
The problem with this is, because there was an error, the subscription is deactivated. So, it wont automatically run.
Any thoughts?
LikeLiked by 1 person
Also, it doesnt end up adding the contacts/leads to the campaign
LikeLiked by 1 person
Hi Megan,
Thanks for the details on what you’ve tried and the results so far.
Question, I’m assuming “Book Giveaways – leads” is the name of your report which errored when you tried to run the custom action “AddCampaignMembersByReportAction”?
I believe I’d need to see the Debug Log results at the time you run the action to further troubleshoot.
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 report action 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 leads or 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/
Thanks,
Doug
LikeLike
Doug,
I have one report and campaign that just wont work. when i run a test in developer console it says that everything is fine. I even deleted the campaign and made another and it still wouldn’t work for this specific one.
Additionally, how do i run the snippet to have more subscriptions in the developer console if i am using your managed package?
Thank you,
Celine
LikeLiked by 1 person
Hi Celine,
Sorry you’re having issues, that’s no fun! I’m working on a new version that hopefully alleviates most of these issues and provides more visibility into the what’s causing errors when they do occur (as well easier way to schedule the job than having to copy & paste the below code).
The snippet for scheduling a job is below, which you can run from an Execute Anonymous window in Developer Console:
Convert_Attachments_to_Files_Settings__c settings = Convert_Attachments_to_Files_Settings__c.getInstance();
ConvertAttachmentsToFilesOptions options = new ConvertAttachmentsToFilesOptions( settings );
System.schedule( ‘Convert Attachments to Files Job’, ‘0 0 13 * * ?’, new ConvertAttachmentsToFilesSchedulable( options ) );
LikeLike
Hi Celine,
I realized after Ken Tallman comment that I’ve provided the instructions how to schedule the job if you deploy the code to your org from GitHub, not if you’ve installed the managed package.
It’s on my todo list to make the managed package schedulable, you can track the progress by subscribing to this issue.
LikeLike
Hello Doug,
i was wondering if this solution also works with contacts to multiple Accounts? I want to add Campaign Members but one Member could be Part of 2 Companies.
A Salesforce Contact is Unique, but i have a Releationship between 2 Accounts (only one can be direct). It is the standard Contact to Multiple Account Feature in Salesforce.
Do you have a Solution for that?
Best
Markus
LikeLiked by 1 person
Hi Sam, this should still work. You define your report to include a contact id and the code adds the contact to the campaign. Doesn’t matter how contact is related to other accounts.
Doug
LikeLike
Hi Doug. This is a great solution; exactly what we need. I installed the original version in a sandbox and it worked well. Now I’m trying to install the updated version (I have more than 5 campaigns I need to assign to) and having difficulty toggling between your GitHub notes (which are excellent, btw) and the commentary on this page. I hate to admit it, but I’m stuck on the Developer Console step, and unsure what to do when I get past it. Please consider expanding your detailed instructions on GitHub to reflect these new features. Thank you.
LikeLiked by 1 person
I tried your Execute Anonymous instructions from Celine above and got this error:
Line: 5, Column: 17
line 5:17 no viable alternative at character ‘‘’
LikeLiked by 1 person
Hi Ken,
Yeah, you’re up against a couple problems you wouldn’t have known about — sorry!
The “no viable alternative at character” error is simply problem where my blog is printing a fancy quote instead of a straight quote. Copy & paste problem. It’d probably work if you typed it out manually instead of copy & paste.
But even if you did type it out perfectly, it likely still won’t work if you’re using my managed package option because I’m inadvertently not exposed the scheduler class as global. Global classes can be used by orgs that install a package. I’m so used to giving out examples how to run my code if deployed directly from GitHub I forgot about the managed package limitation.
I’ll work on exposing the scheduler class in a new version of the package soon.
Sorry about that!
Thanks,
Doug
LikeLike
Thanks for getting back to me Doug. My client needs to send 6 reports to all of their clients just after the first of the month. Any advice for how to do this? I doubt your timeline will support that, so I’ll probably tell them they can only have 5 reports for now, and go ahead and run them through the scheduler.
Please keep me posted when you have a solution to this.
Thanks.
Ken Tallman
6512Consulting.com
970-903-8818
________________________________
LikeLiked by 1 person
Hi Doug. Any update on this? I’d really like to get this functionality operational, as my client is going live this week and this is a pretty important part of the process.
Thanks.
Ken
LikeLike
Hi Doug. Do you have this functionality working yet? If not, can you let me know when to expect it? My client is very anxious to get their automated campaign assignments working. Thank you. Ken
LikeLike
Hi Ken,
I’ve released new version 1.7 of the package tonight that exposes the class AddCampaignMembersByReportSchedulable to be schedulable in subscriber orgs.
Doug
LikeLike
Thanks Doug. Will this help my client automate several campaign assignments, or does this release address different functionality?
LikeLiked by 1 person
Yep.
(1) In Setup navigate to Apex Classes.
(2) Click the “Schedule Apex” button.
(3) For Job Name and Apex Class enter
AddCampaignMembersByReportSchedulable
(4) Choose your frequency then click “Save” button.
On your defined schedule, the code will enqueue batch jobs, one per report+campaign setting defined in your “Add Campaign Members by Report Settings” tab.
LikeLike
Thanks Doug. I’ve installed your latest version and followed your instructions for scheduling the Apex class. Do I also have to schedule each report, as shown in step 6 of your user guide? If so, should that schedule time be prior to the apex job schedule, or does it matter?
LikeLiked by 1 person
Hi Ken,
Great question. No, you only need to schedule that apex class once and it will run ALL the reports you’ve configured in separate batch jobs.
This also means if you use the scheduled Apex route then don’t schedule reports the other way from the report detail page because then the work would be done twice.
LikeLike
Wanted to let you know that this is working great now! With your latest update, my client’s email subscriptions (campaigns) are now automatically added when their client checks the appropriate boxes on the webform. This is a HUGE timesaver for them, and obviously reduces errors too.
LikeLiked by 1 person
Awesome! Thanks for the follow up Ken
LikeLike
Hi Doug. I love this tool and have installed it at a number of my client orgs. My latest effort is to automatically assign an Opportunity to a Campaign and I would love to use this tool. Unfortunately, it looks like it only assigns Contacts and Leads. Any plans to expand it to include Opportunities?
LikeLiked by 1 person
Hi Ken, sounds like interesting idea. Please open a new GitHub issue on the project page to track it. Thanks!
LikeLike
One of my Marketing users is try to test out this app in a sandbox. She has permission to all your app’s Visualforce and related Apex Classes. Whenever she tries to create a record under “Add Campaign Members by Report Settings,” she only sees the Cancel button. There is no Save button. I do not have this issue. What permission am I missing?
LikeLiked by 1 person
Hi Greg, could you provide link to some screen shots showing the issue?
Is your user using the custom tab + visualforce page to add the setting or in Setup | Custom Settings? (they should be using the custom tab + visualforce page).
Do you have the managed package installed or the code deployed directly from GitHub as open source?
Thanks,
Doug
LikeLike
Hey Doug,
It will be difficult to do screenshots of our Salesforce instance due to our company security policy (even though you developed the code).
I am referring to the custom tab + Visualforce page. After clicking “New”, you have the screen to provide the Campaign, Default Member Status, etc. On the page, I see a “Save” and “Cancel” button. This particular user does not see the Save button.
She doesn’t have the same privileges as my admin account so I am trying to find what is missing. She doesn’t have Modify All Data permission by design.
If we had any documentation on minimum access rights needed for your app to work, that might help.
I downloaded the source code from GitHub and then uploaded the source code using Eclipse. This avoided having to grant the GitHub connector access to our instance.
Thanks,
Greg
LikeLiked by 1 person
Hi Greg,
The project comes with a permission set that grants users access to the visualforce page and any custom objects/tabs included. Do make sure the user is assigned that permission set.
I’ve only tested this as an admin, and to be honest I developed it assuming the system admin would be configuring this. It’s possible there’s some permission beyond what’s in my permission set that the user might need.
If it works for you, the admin, I’d recommend coordinating with your user on what they want setup and you may need to do it on their behalf if your concerned about granting the users any more access than you’re comfortable with.
Thanks,
Doug
LikeLike
Doug,
I definitely assigned the permission set but it didn’t help. We try to limit the number of admins on our org. We might have to resort to coordination between this user and an admin. These users set up Campaigns but aren’t given the privilege to see all data since some isn’t part of their team and is sensitive.
Thanks,
Greg
LikeLiked by 1 person
I learned through process of elimination, that the profile would need the “Customize Application” permission to be able to see the “Save” button when creating a setting in your app.
LikeLiked by 1 person
Good to know! Thanks for the follow up Greg
LikeLike
Doug,
Is AddCampaignMembersByReportLoggerTest.cls supposed to be a test class? It doesn’t have the @isTest annotation, nor have any Test methods.
Thanks,
Greg
LikeLiked by 1 person
Hi Greg,
Well that’s embarassing! I had stubbed that class out to be a unit test and guess I never got to it.
Sorry about that!
You can track progress in this GitHub issue.
Doug
LikeLike
Getting this error when running tests in Production on “AddCampaignMembersByReportBatchableTest”:
System.UnexpectedException: No more than one executeBatch can be called from within a test method. Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation.
Stack Trace: External entry point
Do we have a fix?
Found this:
https://help.salesforce.com/articleView?id=000176562&type=1
LikeLiked by 1 person
Hi Greg,
Yes, that test class runs the report Add_Contacts_To_Campaign_Test. You will need to modify its filters to ensure only a handful of records are found.
Unfortunately, with the Analytics API in Apex the tests always run with “seeAllData = true” regardless if we want it to or not. To control the amount of data the test crunches on you can widen or narrow the filters on that report.
Doug
LikeLike
You can track your feature request on github here, but until then you’ll need to add filters to your report in production. Thanks
LikeLike
Thanks Doug!
LikeLiked by 1 person
Hi Greg,
I’ve released new version 1.7 of the package tonight that ensures that in unit tests the batch job only ever runs one execution, regardless the amount of data in the report itself.
Thanks,
Doug
LikeLike
Hi Doug,
I have just installed the tool and created the custom setting to point it to my campaign and the contact report. It all seems to work fine as I am not getting any error. I also receive an email notification to say ‘The conditions you specified when subscribing to the report is met’. However, nothing happens and new contacts are not added to the campaign. I looked at the log and there is nothing in the ‘Add new campaigns’ log that comes in the package.
Can you please advise what I am missing here?
thanks
Jalpa
LikeLiked by 1 person
Hi Jalpa,
Would you please open a GitHub issue for the project and share screen shots of your configuration and test report?
Thanks,
Doug
LikeLike
Hi Jalpa,
I’ve released new version 1.7 tonight that fixes a few bugs, most importantly one if a report had more than 2,000 records and included logical filters. It’s possible you were running into one of those issues.
Please try installing the latest version of the app and if you still encounter issues please report it on GitHub.
Thanks,
Doug
LikeLike
Hi Doug,
Just an update to say that I love your update!!! It’s a great more robust solution. I like the VF page to store the relationships. Very tidy. You could add a scheduling section to that page as well to store the cron.
I will relook at my Declarative Scheduler tool sometime. I might fork your project and rebuild it off this as you have covered all of the bases so well!!
Go declarative tools!
Daniel
LikeLiked by 1 person
Thank you!! I really appreciate the kind feedback. Go declarative tools!
LikeLike
Hi Doug, I am behind on all these bits and pieces. I have updated my declarative scheduler tool that we talk about a while back. So much of it is your tool. A brief overview is here: http://gravitylab.nz/declarative-scheduler-tool/
LikeLiked by 1 person
This is really cool Daniel! Not sure if you are on twitter, but I just shared it there too.
LikeLike
Thanks a lot Doug! After your encouragement, I wrote up some of my notes on the best tools for admins to use. It’s designed to be a list of workarounds while ideas are being developed.
Lot’s of your tools fit in this basket. I added a couple. Let me know any other tools you think would be beneficial:
http://gravitylab.nz/salesforce-admin-tools/
It’s a first draft, but it’s better than not starting.
LikeLiked by 1 person
Hi Doug
Great app. Do you have any plans to provide the ability to update the Member Status via a report subscription if a contact/lead is already in the campaign?
e.g
You want a campaign that always only contain contacts in New York. You create a report and associated subscription that goes and automatically adds contacts with a status X. You create another report for contacts in the campaign it shows contacts who are no longer in New York (address has recently changed etc) and another associated subscription for this which updates the status of these people to say member status = Remove. You could then have a flow automatically remove anyone with a member status = Remove.
Thanks
James
LikeLiked by 1 person
Interesting idea, thanks for the feedback!
LikeLike
Hi Doug,
I inherited an organization that uses this tool and I have been successful in adding additional reports and campaigns. However, I am currently getting an error on two of the test classes when I am attempting to deploy other changes. One of the errors, on the AddCampaignMembersByReportScheduleTest class is:
“AddCampaignMembersByReportBatchable.AddCampaignMembersByReportException: Report with id “00O0L000003RhtAUAS” is missing expected column label “Lead ID” that references a record id like Contact.Id or Lead.Id
Stack Trace: Class.AddCampaignMembersByReportBatchable.: line 43, column 1 Class.AddCampaignMembersByReportSchedulable.execute: line 15, column 1″
I have checked the report it is referencing and it is in the tabular format and does have a column with Lead ID in it.
LikeLiked by 1 person
Hi Peter,
Congrats on your inheritance 😉
My first guess would be ensure the custom setting for the report/campaign config is current. If the Lead id column has changed in the report or its API name on the object since the setting was created then the setting may need to be deleted/re-created.
Doug
LikeLike
Hi Doug, I appreciate the response. It turns out the problem was between the keyboard and the chair. After resolving that I am getting a different and pretty vague error “System.NoDataFoundException: The data you’re trying to access is unavailable.
Stack Trace: Class.reports.ReportManager.describeReport: line 6, column 1 Class.AddCampaignMembersByReportBatchable.: line 33, column 1 Class.AddCampaignMembersByReportSchedulable.execute: line 15, column 1”
I know this is often due to the user not having access to the data (say the report is in someone’s personal folder) but I have no idea what report (or other data it is).
LikeLiked by 1 person
Hi Peter,
If you’re configuring the reports via the custom setting then I recommend reviewing each record in the custom setting and reviewing the report IDs to confirm you have access to them.
I think your instinct is right, that the error is due to user not having access to data being referenced.
Doug
LikeLike