Thursday, 3 February 2011

Automatic Refresh of Campaign Monitor Data in Salesforce

You already know you can retrieve the latest campaign data and results by clicking the links or buttons from Salesforce. That is useful, but it would be even more useful if you can get these updates without having to access the app and click the buttons, by the time you log in to Salesforce every morning.

This can be done using the latest version of Connector for Salesforce + Campaign Monitor and the Scheduled Apex functionality of Salesforce.

First, install the latest version of Connector. If you are upgrading from an existing version, simply install this package on top of your existing installation. If you are installing the Connector for the first time, you will have to refer to the installation and configuration guide.

After the successful installation, you will have to create a few scheduled jobs in Setup in your Salesforce org. Navigate to Setup > App Setup > Develop > Apex Classes, and click the Schedule Apex button (Don't worry, you don't have to write any Apex code!). From the Schedule Apex screen, configure your scheduled job as follows:
  • Job Name: Type "1. snbCampMonSchedulable"
  • Apex Class: Select "snbCampMonSchedulable"
  • Schedule Apex Execution: Set as per your preference

Repeat the same steps with the following Apex classes:
  • snbCMSchedCampSum (New in v3.13, updated August 2013)
  • snbCMSchedEmailOpensCampMem
  • snbCMSchedSubscriberClicksCampMem
  • snbCampMonSchedUnsubscribes
Make sure that the first one, snbCampMonSchedulable, runs before these four when you schedule. 

Updated April 2012: The Apex classes snbCMSchedEmailOpensCampMem and snbCMSchedSubscriberClicksCampMem are only available in the package version 3.7 or later. If you are using an older version of the Connector, please upgrade to the latest version at

Navigate to Setup > Administration Setup > Monitoring > Scheduled Jobs, and the screen should look similar to this:

These scheduled jobs refresh data for 10 recently sent campaigns. This is due to the limitation of Salesforce Apex Governor, which only allows 10 callouts to external systems per execution.


  1. Does the Automatic Refresh of Campaign Monitor Data in Salesforce include Unsubscribes or is it just the Recipient Activity Data?

  2. It can include Unsubscribes as well. From the last screenshot, "4. snbCampMonSchedUnsubscribes" does that job.