Search…
⌃K

Salesforce

Getting Started

Salesforce is both a Source when building Audiences and a Destination where Audience data can be sent. In this guide we will show you how to connect Salesforce to Primer to create and sync your first audience.
There are 3 levels to Primer's Salesforce integration:
  • Read-only (default): When you first connect Salesforce you will automatically be in read-only mode. Primer will ingest domains, first names and last names but can filter by any field on Leads, Contacts, and Accounts to build audiences. By default, you share a minimal amount of data with Primer.
  • Update: Primer can update existing Salesforce records with additional data points (i.e. do CRM enrichment) using the Salesforce Bulk API. Turning this on requires our Technical Solutions Architect and consumes very few API credits.
  • Create: Primer can create new Salesforce records, like Contacts, Leads, or Accounts using the Salesforce Bulk API. Turning this on requires our Technical Solutions Architect and consumes very few API credits. (Note: Primer can also sync new records to other Destinations like Marketo or a data warehouse instead).
Read on to understand the ins and outs.

Pre-requisites

  • Have your Salesforce Service Account ready.
  • Ensure the account is API Enabled with the Session Security Level Required at Login set to "None."
  • Access to the device/email account that will receive a 2FA code.

Required Permissions

We recommend using a stand-alone account specifically for Primer (often called a Service Account) so you can see Primer updates in your audit history. Primer primarily uses the Salesforce Bulk API to sync data to Salesforce in the most API quota-efficient way possible.
The Primer Service Account will need at least these below permissions to connect successfully:
  1. 1.
    "API Enabled" must be checked
  2. 2.
    "Session Security Level Required at Login" must be set to "None".
  3. 3.
    High Assurance on Session security level required at login should be set to disabled at the profile-level. Salesforce blocks some API access when this setting is used on user Profiles and this will prevent Primer from accessing your Salesforce instance.
  4. 4.
    Primer will have the same access to objects and fields as the Salesforce user connected to Primer. So if fields are read-only or hidden for that user, that is what Primer will reflect.
    1. 1.
      For text fields, the fields should be set as 'text' only as opposed to 'text area' fields.
    2. 2.
      You should give Primer "Read", "Create", "Edit", and "Delete" access to the "Lead," "Contact," and "Account" objects. While Primer does not currently delete any records, we retain this for future product features, but we will never delete or overwrite data unless you explicitly ask.
  5. 5.
    Salesforce requires that the user account have the "View Setup and Configuration". Ensure the user account have the "View Setup and Configuration" permission. This permission is set on the Profile of the connected user under the "Administrative Permissions" heading.

Connecting Salesforce

The first step in setting up your Primer instance is setting up your Integrations. Here's a quick video showing you how to connect your CRM (either Salesforce or Hubspot) directly to your Primer instance. This read/write connection will allow you to fully harness the power of Primer's orchestration capabilities.

Field Mapping

Once your CRM is connected to Primer, you will be able to map fields directly within Primer.
In order to pull in People-level data (Contacts or Leads, there are three minimum required fields that need to be mapped within Primer:
  • First Name
  • Last Name
  • Company Domain
To build high performing ad audiences from your CRM we highly recommend you map additional fields like work email, LinkedIn profile URL, and individual location so that our identity resolution algorithm has as much data as possible to work with.
In order to pull in Company-level data (Accounts within SFDC, there is only one required field that needs to be mapped within Primer:
  • Company Domain

Syncing Data into Salesforce

Once the fields have been mapped within Primer, our Technical Solutions Architect will reach out to schedule time for a CRM Sync Review. This call is best done by your internal CRM administrator or other technical stakeholder.
Prior to the call, we will request your CRM administrator to fill out a CRM Sync Survey so that we can fully understand how you want the data to flow into your CRM.

Identifiers on Salesforce objects

Matching People and Companies from Primer to Leads, Accounts and Contacts in Salesforce requires a join key, also known as an identifier. By default, Salesforce lets Primer use Work Email as the identifier for Leads and Contacts.
Ideally, Primer would use the Website field when syncing to Accounts. Unfortunately, Salesforce does not allow the standard Website field to be an external identifier. Luckily, Primer has a quick fix. Our customers must create a new custom field and copy the Account's Website value into it. Below we'll walk you through how.

How to add a new External ID to your Salesforce Object

  1. 1.
    In Salesforce, go to Setup, open the Object Manager, and click on the Account Object.
  2. 2.
    Select Fields & Relationships and press the New button in the top right.
  3. 3.
    Select the type of field. You'll want to stick to the Text type as most others cannot be made into an External ID in the next step.
  4. 4.
    Define your new ID field. Make sure to select in field settings: External ID AND Unique. You can choose between case sensitive and case insensitive. Unique is strongly recommended. Without it, two records may have the same identifier value and we can't ensure we're updating the correct record. Case insensitive is a safer choice if you're ever going to have humans inputting website values. However, in rare cases this could introduce a problem with computer-generated identifiers.
  5. 5.
    Continue through the field creation process and hit Save.
  6. 6.
    The field should now appear as an option in Primer when creating a new sync. You may need to hit the Refresh button next to the menu if we haven't updated metadata since you created the new field.
Next you're going to need to build a Flow to copy the Account website into this new external ID field. We'll describe how to do this in the next step, which includes website cleaning.
Populate the new External ID and Unique field
Now that a new External ID and Unique field is created (e.g., Primer External ID), the existing values of all Accounts' Website field need to be filled retroactively and continuously going forward. We'll also make sure that the copied field is cleaned. This can also be done on the Website field before copying, whatever is preferred.
Do your website URLs contains "http://" or "www."? If so, you'll need to clean them up with the formula below.
SUBSTITUTE( IF( FIND("/", IF( FIND("www.", {!$Record.Website}) > 0, IF( FIND("//", {!$Record.Website}) > 0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//www.", {!$Record.Website}) + 5), NULL ), {!$Record.Website} ), IF( FIND("//", {!$Record.Website}) > 0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//", {!$Record.Website}) + 1), NULL), {!$Record.Website} ) ) ) > 0, LEFT( IF( FIND("www.",{!$Record.Website})>0, IF( FIND("//",{!$Record.Website})>0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//www.",{!$Record.Website}) + 5 ), NULL), {!$Record.Website} ), IF( FIND("//",{!$Record.Website})>0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//",{!$Record.Website}) + 1 ), NULL ), {!$Record.Website} ) ), FIND("/", IF( FIND("www.",{!$Record.Website})>0, IF( FIND("//",{!$Record.Website})>0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//www.", {!$Record.Website}) + 5 ), NULL ), {!$Record.Website}), IF( FIND("//",{!$Record.Website}) > 0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//",{!$Record.Website}) + 1 ), NULL ), {!$Record.Website} ) ) ) -1 ), IF( FIND("www.",{!$Record.Website})>0, IF( FIND("//",{!$Record.Website})>0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND("//www.",{!$Record.Website})+5), NULL ), {!$Record.Website} ), IF( FIND("//",{!$Record.Website})>0, SUBSTITUTE( {!$Record.Website}, LEFT( {!$Record.Website}, FIND( "//", {!$Record.Website}) + 1 ), NULL ), {!$Record.Website}) ) ), 'www.', '' )
How to back-fill Primer External ID
  1. 1.
    In Salesforce, go to Setup and Quick Find Flows.
  2. 2.
    Select Flows and click New Flow in the upper right. This will open the Flow Builder.
  3. 3.
    Select Schedule-Triggered Flow. Click Create.
  4. 4.
    Set Schedule to a time in the future for when this mass-update should run. If you have a lot of Accounts, you should schedule this for an off-peak time, such as during a weekend or early-morning hours. Set Frequency to Once.
  5. 5.
    Follow the Choose Object prompt and search for the Account object. If you would like to test update specific Accounts, you may specify the conditions here. Otherwise, select None—Run Flow For All Accounts under Condition Requirements and click Done.
  6. 6.
    Click the (+) Add Element button on the Flow Builder UI. Scroll to the bottom and select Update Records.
  7. 7.
    Label the Update Records Element as you'd like, such as Fill Primer External ID. The API Name should populate automatically. Ensure Use the account $Record global variable is selected under How to Find Records to Update and Set Their Values. Next, similar to Step 5, select None—Always Update Record. Finally, search for your newly created Primer External ID field in the Set Field Values for Account Record section. In the Value text box, click the drop-down element + New Resource. This will open another modal.
  8. 8.
    In the Resource Type drop-down, select Formula. Name the Formula and select Text from the Data Type drop-down. Next, copy and paste the formula below into the Formula text area. Once pasted, click Done and Done again. Save and Activate your new Flow and it will update the field at the time you specified in Step 4.
How to continually update the Primer External ID field
  1. 1.
    In Salesforce, go to Setup and Quick Find Flows.
  2. 2.
    Select Flows and click New Flow in the upper right. This will open the Flow Builder.
  3. 3.
    Select Record-Triggered Flow and click Create.
  4. 4.
    At the prompt, select the Account object. Trigger the flow when A record is created or updated. Do not set any condition requirements. Select Fast Field Updates. Click Done.
  5. 5.
    Click the (+) Add Element button on the Flow Builder UI. Click Assignment under Logic.
  6. 6.
    Name the assignment. Select the $Record global variable and then Primer External ID field. Keep the Equals operator. In the Value text box, click the drop-down element + New Resource. This will open another modal.
  7. 7.
    In the Resource Type drop-down, select Formula. Name the Formula and select Text from the Data Type drop-down. Next, copy and paste the cleaning formula above into the Formula text area. Once pasted, click Done and Done again. Save and Activate your new Flow so any records created or updated going forward will have your new field filled.
Now that the External ID is setup and filled, we're all set to start pushing new data into your Salesforce instance.

Troubleshooting Salesforce

Why Can't I Select Some Salesforce Fields to Map to Primer?

If you're in Salesforce Settings > Mappings (tab) and you're not seeing fields you have in Salesforce that you'd like to map to fields in Primer, there's a couple common blockers in Salesforce to check for:

Credentials

It's possible the Salesforce credentials you're using to link to your Primer account don't have access to that field/all fields in Salesforce. Go into your Salesforce account and check the settings for those Salesforce users to make sure they have been granted access to all fields.

Field Visibility

If your Salesforce user credentials check out, check the field itself in Salesforce to confirm it has proper Field Level Accessibility and Field Level Security (be sure to change those settings if your field is set to "Hidden" and/or "Read-Only")
https://downloads.intercomcdn.com/i/o/267941913/024dc0baa0ca1571fef20fcc/image.png
https://downloads.intercomcdn.com/i/o/267941901/0d250baf0461108a3f1f288f/image.png

Field Type

Lastly, double check: Is your Salesforce field one of the field types we allow for that field mapping? In general it's best if the field type of your SFDC field corresponds to the field type of the Primer field you're mapping it to.

Salesforce Tips & Tricks

Automatically Add Records to Campaigns

Option 1: Salesforce's Process Builder

Create a Process that will add the Lead you are creating or modifying to a SFDC Campaign:
  1. 1.
    Open Process Builder:
    1. 1.
      Salesforce Classic: Setup | Create | Workflows & Approvals | Process Builder
    2. 2.
      Lightning Experience: Gear icon | Setup | Platform Tools | Process Automation | Process Builder
  2. 2.
    Click on New | Enter Process Name. Then click Save.
  3. 3.
    Click Add Object. Select Lead.
  4. 4.
    Select when you need to start the process: only when a record is created or when a record is created or edited.
  5. 5.
    Click Save.
  6. 6.
    Set criteria:
    1. 1.
      Enter a Criteria Name (something like Attach Lead to Campaign).
    2. 2.
      Enter the Conditions that must be met for the lead to be added to the campaign if any, otherwise select No criteria—just execute the actions!
    3. 3.
      Click Save.
  7. 7.
    Add Immediate Actions:
  8. 8.
    Select the Create a Record Action Type.
    1. 1.
      Enter an Action Name.
    2. 2.
      Select Record Type: Campaign Member.
    3. 3.
      Set Field Values: Campaign Id: 15 digit Id of the Campaign (You will find the Id in the URL of the campaign record). Lead Id (Type: Reference): [Lead].Id
    4. 4.
      Note: No need to set criteria for any other fields unless they are required in the Campaign Member records.
  9. 9.
    Save and Activate the Process.

Option 2: For Inbound Leads - Salesforce’s Web-to-Lead

Salesforce’s Web-to-Lead functionality is a great way to get leads directly into Salesforce. Salesforce Campaigns provide useful data on what happened to the leads and contacts produced from various marketing activities.
Besides making sure inquiries don’t fall through the cracks by using web-to-lead functionality with Salesforce, any additional data you can add to your web site forms can help your business.
Source and keyword data can be added and there are a number of other things that can be added to the form through hidden fields.
One easy addition is to hard-code a particular Salesforce Campaign value in your web-to-lead forms.
This is especially useful if you have many landing pages that are specific to certain advertising campaigns, but you can even do it with your standard “Contact Us” form.
Here’s how to do it:
  1. 1.
    Create a Campaign in Salesforce (or go to an existing Campaign)
https://downloads.intercomcdn.com/i/o/212507149/10f3e445e9fb36b2b6d95e5b/campaign1.png
  1. 1.
    Copy the ID of the Campaign from your web browser’s address bar
https://downloads.intercomcdn.com/i/o/212507166/5fe0d97c0e4ee7b7de6bd401/campaign2.png
  1. 1.
    Have your web designer add the following hidden field to your web-to-lead forms, replacing the value with the ID you copied earlier.
<input type="hidden" name="Campaign_ID" value="7010V000001ufMI">
  1. 1.
    That’s it! (But run a couple of test leads!)

Creating Salesforce Activities

As part of the Salesforce integration, you have the option to synchronize the Activities that occur in Primer (ad audience creation, LinkedIn Connect Requests sent, etc.) allowing you to log every detail of your relationship with each Lead or Contact in your CRM.
To push Activities from Primer to Salesforce, follow these steps:
  1. 1.
    Go to the Integrations page.
  2. 2.
    Click on the Salesforce > Edit Accounts option
  3. 3.
    Scroll down to the Activities section
https://downloads.intercomcdn.com/i/o/267940466/1658ff759381b9b16081b8fa/image.png
Enable whether or not you would like to push completed “Steps” in a Primer campaign as Completed Tasks to Salesforce.
For example, when a Salesforce Lead is synced to Facebook as part of an audience, Primer will create a Completed Task in Salesforce against the Lead record.
Primer will sync over the Primer Campaign Name, the Step action taken, and the name of the Step Destination (e.g. Facebook Account ID 35945809348).
If you'd like to build report to show what Primer Campaign led to most of your converted Leads, now you can!