top of page

Upsert Contacts to a Campaign

  • Writer: Michael Kolodner
    Michael Kolodner
  • 3 minutes ago
  • 4 min read

There are all kinds of scenarios in which we find ourselves with a list of people that we want to add to a campaign but we know the list includes a mix of existing Salesforce contacts and people that might be in the database yet. Happens all the time, right? Maybe you get a handwritten sign-in sheet. Or someone emails you the list of people they want to add to an event. Or you're combining lists from several people.


Freebie shaking hands with another dog.

In this situation, what we really want to do is an “upsert” of contacts (Upsert means “update them if they exist, otherwise insert them as new records.”) and also add those contacts to a campaign. I suppose, depending on what we're doing, the campaign might already be in Salesforce or we need to create it for this import.


Let's assume the simplest scenario: We have a simple sheet of people that includes three columns:

  • First Name

  • Last Name

  • Email

Several rows of mock data in a table.

In addition to those three columns, there are two additional pieces of information we presumably have, either on the spreadsheet already or at least in our head:

  • Which campaign we want to add these people to. (Either we know the campaign exists in Salesforce or we know it does not and we want to create it.)

  • What campaign member status each person should end up with after this import.


We also know (or at least suspect) that the emails on our spreadsheet might be a mix of the values we have in the personal, work, and alternate email fields for our existing contacts. (Because the world is just fun like that!)


With only access to regular import/export tools we would have to work on this in multiple steps.

  • Download a list of contacts and use vlookup to find Salesforce Ids for those that exist.

  • Then insert those that don't,

  • get their contact Ids and add them to the spreadsheet.

  • Then import a list of campaign members for all the Ids.

What a pain in the butt!


NPSP Data Import Object to the Rescue!

Usually only used for the initial data load to a new implementation, the NPSP Data Import object is really handy for this need!


If you're working in an NPSP instance (and most nonprofits are), you can do this in just three simple steps:

  1. Load records of the NPSP Data Import object from your spreadsheet.

  2. [Optional] Do a dry run of the processing of those records.

  3. Process those records into the database, creating contacts, campaigns, and campaign members.


1. Load to the NPSP Data Import Object

NPSP Data Import is a simple holding object. It has many fields on it that correspond to fields on contact, account, opportunity, campaign, etc. Records of this object do nothing special, they just wait to be processed to become multiple records. In the case of our spreadsheet, use whatever upload tool is handy to end up with one NPSP data import record for each row of the sheet. Those records will look like this,

A record page of the NPSP Data Import object.

with values in Contact1 First Name, Contact1 Last Name, one of the Contact1 email fields, plus Campaign Member Status and Campaign Name.


If you use Campaign Name, expect Salesforce to either match on that campaign name (Exact match!) or to create a new campaign with that name. If, on the other hand, you want to select an existing campaign, just fill out the Donation Campaign Source lookup field (highlighted with a red rectangle).


An important note about Campaign Member Status: The Campaign Member Status field on the NPSP Data Import object is just a free text field. There is no validation that the values you use here will match the campaign member statuses of campaigns in your instance. The importer will create campaign members with whatever status(es) you give it. So be careful to only have values in your spreadsheet that match the values you normally use. "RSVP Yes" is different from "RSVP Y" and from "RSVP-Yes" and from "RSVP - Yes". They're subtle differences, but if you aren't consistent with your campaign member statuses, they can be annoying ones!


2. [Optional] Do a dry run of the processing of those records.

Now that you have several NPSP Data Import records created by your import, you can go to the NPSP Data Imports tab. There, you'll see all the records that are ready for processing. The Import All Data Import Records button

The Import All Data Import Records button from a list view.

will bring you to the NPSP Data Import screen.

The NPSP Data Import tool.

Though optional, it's generally recommended to do a dry run before your final import, which allows you to see how the system would match or create records.


3. Process Records Into the Database

Once you're confident that things are going to go smoothly, just go back to the NPSP Data Import tool and click Begin Data Import Process, which will do the final processing of your records into the database. Contacts are upserted (matched or inserted) and added to the campaign, which was itself matched or inserted.


How cool is that!?!


Other cool tricks:


So. Many. Fields.

I only talked about three data fields (first/last/email). But the NPSP Data Import object has fields for multiple emails, salutation, title, preferred email, preferred phone, account data, and much more. You can also use the object's power for a whole lot more than just adding people to a campaign. See the full documentation.


You don't have to work on only one campaign at a time!

Though I wrote this post focusing on a sheet of people to be added to a single campaign, you aren't limited to that. Put in some people with one campaign and others with another and you'll end up with two campaigns populated at once. Nice!


Unduplicated Contacts

Go ahead and put the same person on two rows of your spreadsheet with different campaign names. The data importer will not duplicate the contact, but it will put him into two campaigns (with different statuses, if that's what you had on your import).

Record page for Frank Enstein and the related list showing him in two campaigns, Torch Carrying and Castle Storming.

Don't wait for the next post! Get them in your In Box.

bottom of page