7. Mailchimp to Salesforce Integration - Delete Campaign Member

Business Problem

Mailchimp - Logo

MailChimp is a great tool for people who are just starting out with email marketing and they currently use Salesforce as their CRM. We have done several implementations of MailChimp and Salesforce and wanted to provide you with our best practice approach of how to set it up right the first time.

This is Part 7 of how to setup the Mailchimp to Salesforce integration where we will show you how to solve the following business challenge we ran into while implementing Mailchimp for Salesforce. Check out our Mailchimp How To section for additional tips on how to extend this integration.

  • Delete Campaign Member from Salesforce Campaign Automation - When a MailChimp subscriber unsubscribes from an audience, we want to delete the campaign member from a Campaign in Salesforce.

Or continue on for a short tutorial below.
Note: The video tutorial goes way more in depth.

How to Instructions

Delete Campaign Member from Salesforce Campaign if they Unsubscribe

Our objective here is to automatically delete the Campaign Member from a Salesforce Campaign when a MailChimp Subscriber unsubscribes from an audience in MailChimp. If you completed the steps in MailChimp to Salesforce Integration - Part 2 -Update Unsubscribes you already have the flow in place that we will build off of for this automation. If you have not, please review this article and complete the setup of the flow for at least the Unsusbcribed path.

  • First, we need to create a new checkbox field on the Campaign object called MC Delete Unsubscribes. This checkbox will allow us to control which Campaigns should have the campaign members deleted when the Contact unsubscribes from Mailchimp.

  • Next, we need to create a formula checkbox field on the Campaign Member object called MC Delete Unsubscribes = Campaign.MC_Delete_Unsubscribes__c

    • This field is just pulling over the value from the related Campaign onto the Campaign Member to help us later in the automation.

  • Now, go to the flow you created in Part 2 called MC Subscriber | Update Fields on Contact and create a new version.

  • Click the + sign below the Update Contacts element on the Unsubscribed path.

  • Click Get Records

  • Configure the Get Records element:

    • Name = Get Campaign Members
    • Object = Campaign Member
    • Filter Campaign Member Records:

      • MC_Delete_Unsubscribes__c = True
      • Email = {!$Record.MC4SF__Email2__c}

    • How many records to store: All records

  • Click the + Sign below

  • Select the Delete Records element.

  • Configure the Delete Records element

    • Label = Delete Campaign Members
    • How to Find Records to Update and Set Their Values = Use the IDs and all field values from a record or record collection
    • Record or Record Collection = {!Get_Campaign_Members}

  • Click Activate - we are ready to test it!

How to Test the Flow

  • Create two contact records with the same email address in Salesforce. Make sure the email address for these contacts is also an active MailChimp Subscriber.
  • Create a Salesforce Campaign and add these two contacts to the Campaign.
  • Update the MC Delete Unsubscribes checkbox on the Campaign to be true
  • Confirm the flow is active
  • Go to one of the Contact's pages in Mailchimp and click Unsubscribe
  • Check your campaign and confirm the Contacts were deleted from the Campaign. If they are gone, congratulations!! Now you are ready to let it rip with the entire audience!
MailChimpSubcriptionUnsubscribefromSalesforce

For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!

Share This Story, Choose Your Platform!

About the Author

Cheryl Fernandes

Cheryl is a certified Salesforce Application Architect and is the Founder and Lead Salesforce Consultant at Blu Ninjas. She has been working with Salesforce for 12 years and has helped companies in financial services, insurance and beauty industries implement solutions on the platform. Flow is her favorite Salesforce declarative tool, it is a game changer for anyone who does not know how to code.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top