# Salesforce

{% hint style="warning" %}
**Important Note:** Your Salesforce user account MUST have the proper permissions to perform the following actions within Salesforce:

* Create custom fields, delete custom fields
* Assign permissions to those custom fields
* Create contacts, delete contacts
* Create or update the GrowSurf-managed Salesforce PushTopic used for referral-trigger events

If the you do not have these permissions, the Salesforce integration cannot be enabled within your campaign. Please contact your Salesforce system administrator to update your user account with the listed permissions to proceed.
{% endhint %}

## Referral Trigger

### Description

When you connect your Salesforce account to your GrowSurf campaign and enable *Referral Trigger*, GrowSurf can automatically detect and trigger referrals when the Salesforce records you choose match the conditions you configure.

GrowSurf lets you choose one Salesforce object, one direct trigger field on that object, and one exact value to match. Supported objects include:

* Opportunity
* Lead
* Contact
* Account
* Other Salesforce custom objects that are queryable in your Salesforce account

GrowSurf then determines which participant should count as the referred participant:

* **Opportunity:** By default, GrowSurf uses the *Primary Opportunity Contact*. You can also choose *All Opportunity Contacts* as an advanced option.
* **Lead:** GrowSurf uses `Lead.Email` to find the referred participant.
* **Contact:** GrowSurf uses `Contact.Email` to find the referred participant.
* **Account** and **Other Salesforce Object:** GrowSurf can use a direct email field on that object, a direct Contact lookup, or a direct Lead lookup to find the referred participant.

{% hint style="info" %}
**Note:** GrowSurf creates and manages its own Salesforce PushTopic for referral-trigger events. If Salesforce connects successfully but enabling or changing the *Referral Trigger* fails, ask your Salesforce administrator to confirm that the connected user has the API access and PushTopic permissions required to create and update that GrowSurf-managed PushTopic.
{% endhint %}

In order for a referral to trigger from within Salesforce, the following must be true:

1. The selected Salesforce record must exist
2. The selected trigger field on that record must match the exact value you configured
3. GrowSurf must be able to resolve one or more referred-participant email addresses from the matching rule you selected
4. One or more of those resolved email addresses must already exist as participants in the GrowSurf campaign connected to Salesforce

If all of the above holds true and a participant match is found, the referral will trigger within GrowSurf. Referral credit will then be given to the referrer and unlock any rewards, if applicable.

Here's how to set up Salesforce referral triggers:

### **How to Set Up**

{% hint style="warning" %}
**Important Note:** Unless your campaign is configured to add participants automagically ([see image](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-LgbRcVrYaKYUhQVctKK%2F-LgbS62PrNqHiJm-qwdI%2FScreen%20Shot%202019-06-05%20at%207.42.50%20PM.png?alt=media\&token=85e064ce-4bac-4617-9481-f80215478d51)), you'll need to make sure you first call JavaScript [`growsurf.addParticipant()`](https://docs.growsurf.com/integrate/javascript-web-api/api-reference#add-participant) or REST API [`/POST Add Participant`](https://docs.growsurf.com/developer-tools/rest-api/api-reference#add-participant) to add new participant&#x73;**.**
{% endhint %}

**Step 1**: In *Campaign Editor > 4. Options > Integrations*, click the *Connect to Salesforce* button.

<figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FSRS7d6rB9tVvUGW6P8hG%2FScreen%20Shot%202026-04-15%20at%201.47.18%20PM.jpg?alt=media&#x26;token=03b7e4df-79a5-45de-b9c7-ae819422129f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** Once connected, Salesforce requires us to collect certain information from your organization, such as Org ID and business address. Please contact your GrowSurf customer success manager [here](https://growsurf.com/book-success-call) to submit your organization details.

The Salesforce integration will continue to work without this information, however, to ensure there are no service interruptions please submit this information within 3-5 business days of your first GrowSurf invoice payment.
{% endhint %}

**Step 2:** Once connected, toggle the switch to enable the Referral Trigger.

<figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FDHBpSYGe2scgv2VwDdTB%2FScreen%20Shot%202026-04-15%20at%201.23.13%20PM.jpg?alt=media&#x26;token=83d47ad7-aa13-4156-b8a6-52ae940e6b10" alt=""><figcaption></figcaption></figure>

**Step 3:** Choose the Salesforce object, direct trigger field, and exact value that should count as the qualifying referral event.

**Step 4:** Choose how GrowSurf should identify the referred participant when that record matches.

* For Opportunities, choose either *Use the Primary Opportunity Contact* or *Use all Opportunity Contacts (advanced)*.
* For Leads and Contacts, GrowSurf automatically uses the record's email field to find the referred participant.
* For Accounts and custom objects, choose a direct email field, Contact lookup, or Lead lookup that points to the referred participant.

**(Optional) Step 5:** You can add a referral trigger hold period by toggling the *Show advanced settings* section.

{% hint style="info" %}
**Note:** The referral trigger hold period is useful for making sure that Salesforce records that stop matching do not count as referrals. During this hold period, if the selected Salesforce record no longer matches the condition you configured, the referral trigger will be cancelled completely.
{% endhint %}

<figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FYJpOVVSFHdwvLrwPV8C9%2FScreen%20Shot%202026-04-15%20at%201.34.02%20PM.jpg?alt=media&#x26;token=9d7f17f9-e476-4e1c-8763-a2d8ca2c51fc" alt=""><figcaption></figcaption></figure>

### Troubleshooting Tips

* When testing out the Salesforce Referral Trigger integration, make sure to view participants' activity logs for details that can help you troubleshoot any issues.
* Salesforce record updates are sent to GrowSurf asynchronously and could take up to one minute or longer depending on load. Until the event is received, GrowSurf cannot process the event and trigger the referral. Furthermore, we use a message queue to process these events. If you do not see a referral trigger right away, please be patient.
* If Salesforce connects but GrowSurf shows an error when you save or change the *Referral Trigger*, ask your Salesforce admin to confirm that the connected user can create and update the GrowSurf-managed Salesforce PushTopic and has the required API access.
* If you are using *Use the Primary Opportunity Contact* for Opportunities, make sure exactly one primary contact is marked on the Opportunity. If there is no primary contact, GrowSurf will not trigger the referral for that Opportunity.
* If you are using an Account or custom object, make sure the matching rule points to a direct email field, Contact lookup, or Lead lookup on that same object. GrowSurf does not follow indirect relationship chains for Salesforce referral triggers.

## Sync Data

### **Description**

When new GrowSurf participants are added to your campaign, they will automatically be added/updated as Salesforce contacts with new *GrowSurf Field Labels.* Their unique share link and referrer information will be available for use in emails and reports.

### How to Set Up

**Step 1:** In *Campaign Editor > 4. Options > Integrations*, click the *Connect to Salesforce* button

{% hint style="info" %}
IMPORTANT: Because the GrowSurf data sync to Salesforce only occurs *after* you have connected with the integration, it is imperative to connect with the integration *BEFORE* importing participants.\
\
[Click here](https://support.growsurf.com/article/385-how-can-i-sync-my-growsurf-participants-to-my-esp) to see remedy options if you have already imported participants into your campaign but would like to sync their GrowSurf data to Salesforce.
{% endhint %}

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MiXh4ZB_ggbotxx_PWL%2F-MiYB-t2I7SRBT3VR4nT%2FScreen%20Shot%202021-09-01%20at%202.48.16%20PM.png?alt=media\&token=1c662795-e488-4635-a3a8-df9aa41abb37)

**Step 2:** Give GrowSurf authorization to connect to Salesforce

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MiXh4ZB_ggbotxx_PWL%2F-MiYBSDudWNKReB9PcHp%2FScreen%20Shot%202021-09-01%20at%203.06.21%20PM.png?alt=media\&token=705568a0-37bc-45c4-8300-3c07f5c28570)

{% hint style="info" %}
**Note:** Once connected, Salesforce requires us to collect certain information from your organization, such as Org ID and business address. Please contact your GrowSurf customer success manager [here](https://growsurf.com/book-success-call) to submit your organization details.

The Salesforce integration will continue to work without this information, however to ensure there are no service interruptions please submit this information within 3-5 business days of your first GrowSurf invoice payment.
{% endhint %}

### Enabling Contact Field Visibility in Salesforce

Once you have successfully connected to Salesforce, GrowSurf fields are automatically available. However, in some cases, the custom field permissions must be modified to grant other Salesforce users access and allow visibility.

To find contact fields and add permissions to those fields as an admin, follow the steps below:

**Step 1:** In Salesforce navigate to *Setup > Object Manager > Contact > Fields and Relationships*

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MiXh4ZB_ggbotxx_PWL%2F-MicWL9ptxQ86fwCvlIU%2FSalesforce%20fields%20and%20relationships.png?alt=media\&token=0ef54e71-11bb-4783-87dd-8905c68efac8)

**Step 2:** Select a Field Label from the list

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigPpxxx5-t_TW1oFig%2FSalesforce%20fields%20and%20relationships.png?alt=media\&token=c306c210-e4ae-4cdf-93ea-e791bfb4008e)

**Step 3:** Click the *Set Field-Level Security button* and make modifications.

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigOdN6k9RPpYO3qJT6%2FScreen%20Shot%202021-09-03%20at%2010.59.05%20AM.png?alt=media\&token=2cd959ba-3020-4e1d-a4be-40c76a6580a5)

{% hint style="danger" %}
**Critical Note:** If any of the defaulted permissions (currently System Administrator and Standard User) are removed, GrowSurf will not have the ability to add contacts with the GrowSurf custom fields (e.g., GrowSurf Share URL).
{% endhint %}

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigPUXmC5uYPNIa_xFI%2FScreen%20Shot%202021-09-03%20at%2011.05.05%20AM.png?alt=media\&token=0dbbe773-5849-40de-b562-499b4cfa98bc)

### How to Add Fields to Page Layouts in Salesforce

To view the GrowSurf custom fields within Salesforce, you must update one or more page layouts so that the fields appear for contacts within Salesforce.

**Step 1:** In Salesforce navigate to *Setup > Object Manager > Contact > Page Layouts*

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigQEuHpnKJTQtEnxJY%2FScreen%20Shot%202021-09-03%20at%2011.10.07%20AM.png?alt=media\&token=3e5a95ef-daf3-4b0a-b332-bd122d397436)

**Step 2:** Select the target page layout from the list

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigQcfy4wPYWVAs5FKr%2FScreen%20Shot%202021-09-03%20at%2011.11.48%20AM.png?alt=media\&token=b0d8c27c-5e33-4ed7-9006-25cf89fa1fbc)

**Step 3:** Click and drag one or more GrowSurf custom contact fields into the view

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MiXh4ZB_ggbotxx_PWL%2F-Mic_p4oMIC0RKuMFbnP%2FScreen%20Shot%202021-09-02%20at%205.12.43%20PM.png?alt=media\&token=043d4bd5-e63f-42c1-ac0d-1d0770718649)

**Step 4:** Click the *Save* button

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigRIXTtox_Rk1gt9z1%2FScreen%20Shot%202021-09-03%20at%2011.14.03%20AM.png?alt=media\&token=2a8d1b59-39bc-4f15-a104-3a8cf056fc7d)

**Step 5:** Navigate to the layout to view the added fields

![](https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeklWo0yn03AhWro2Ux%2F-MigMTvkq1TdRnLwqYYR%2F-MigSVoI7K_eDzTUkF0M%2FScreen%20Shot%202021-09-03%20at%2011.18.43%20AM.png?alt=media\&token=267e770f-df84-4310-86a1-1b6b1ce85d84)

### Examples

[View our Salesforce tutorials](https://docs.growsurf.com/integrations/salesforce/tutorials) to see different kinds of examples that you can copy/paste into your email templates.

### Contact Field Labels

GrowSurf will automatically create these new contact field labels for your Salesforce contacts.

| **Field Label**                                   | **API Field Name**                            | **Type** | **Description**                                                                                                                                                                                           | **Example**                                                  |
| ------------------------------------------------- | --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| GrowSurf Share URL                                | `growsurf_share_url__c`                       | URL      | The participant's unique Share URL (contains their unique GrowSurf ID)                                                                                                                                    | `https://piedpiper.com?grsf=d77a8j`                          |
| GrowSurf Participant ID                           | `growsurf_participant_id__c`                  | Text     | The participant's unique GrowSurf ID                                                                                                                                                                      | `d77a8j`                                                     |
| GrowSurf Referral Status                          | `growsurf_referral_status__c`                 | Text     | The referral status of the participant\*                                                                                                                                                                  | `CREDIT_PENDING`                                             |
| GrowSurf Referrer Email                           | `growsurf_referrer_email__c`                  | Email    | The email of the participant's referrer                                                                                                                                                                   | `gavin@hooli.com`                                            |
| GrowSurf Referrer First Name                      | `growsurf_referrer_first_name__c`             | Text     | The first name of the participant's referrer                                                                                                                                                              | `Gavin`                                                      |
| GrowSurf Referrer Last Name                       | `growsurf_referrer_last_name__c`              | Text     | The last name of the participant's referrer                                                                                                                                                               | `Belson`                                                     |
| GrowSurf Participant First Name                   | `growsurf_participant_first_name__c`          | Text     | The participant's First Name                                                                                                                                                                              | `Bob`                                                        |
| GrowSurf Participant Last Name                    | `growsurf_participant_last_name__c`           | Text     | The participant's Last Name                                                                                                                                                                               | `Loblaw`                                                     |
| GrowSurf Total Referral Count                     | `growsurf_total_referral_count__c`            | Number   | The participant's all-time referral count                                                                                                                                                                 | `0`                                                          |
| GrowSurf Monthly Referral Count                   | `growsurf_monthly_referral_count__c`          | Number   | The participant's current month referral count                                                                                                                                                            | `19`                                                         |
| <p>GrowSurf</p><p>Prev Monthly Referral Count</p> | `growsurf_previous_monthly_referral_count__c` | Number   | The participant's previous month referral count                                                                                                                                                           | `200`                                                        |
| GrowSurf Next Milestone                           | `growsurf_next_milestone__c`                  | Text     | The text for the next/upcoming milestone reward (only applies to milestone rewards. [See an example here](https://docs.growsurf.com/developer-tools/embeddable-elements#embedded-next-milestone))         | `You are only 2 referrals away from winning a free t-shirt!` |
| GrowSurf Next Monthly Milestone                   | `growsurf_next_monthly_milestone__c`          | Text     | The text for the next/upcoming monthly milestone reward (only applies to milestone rewards. [See an example here](https://docs.growsurf.com/developer-tools/embeddable-elements#embedded-next-milestone)) | `You are only 2 referrals away from winning a free t-shirt!` |
| GrowSurf Total Invite Count                       | `growsurf_total_invite_count__c`              | Number   | The participant's all-time invite count                                                                                                                                                                   | `112`                                                        |
| GrowSurf Total Impression Count                   | `growsurf_total_impression_count__c`          | Number   | The participant's all-time impression count                                                                                                                                                               | `150`                                                        |

\**GrowSurf Referral Status* can be the following: `CREDIT_PENDING` (This participant must still trigger a referral for their referrer to receive referral credit), `CREDIT_AWARDED` (This participant triggered a referral and their referrer received referral credit), `CREDIT_EXPIRED` (This participant did not trigger the referral credit within the referral credit expiration window so their referrer did not receive referral credit).

### Troubleshooting Tips

* **If the new participant isn't being added to Salesforce, or if they are being added but their unique referral link isn't being synced to Salesforce:**
  * Activity logs will denote if a participant was added to Salesforce or if they failed to be added. (In the case of failure, GrowSurf will re-attempt to add them for 7 days).
* **If the new participant is being added twice to Salesforce (as a Lead and Contact):**
  * If you are tracking referrals on a form (typically a Marketo form), you will always see a new Salesforce contact created/updated by GrowSurf. This is the expected behavior, as GrowSurf will create/update Salesforce Contact objects regardless of Salesforce Lead objects. Your form most likely has an automation that also generates a Salesforce Lead upon form submission.
    * **NOTE:** Even if you have a Duplicate Rule set up in your Salesforce instance to prevent Leads and Contacts from having the same email address, GrowSurf will still create a new Contact if it does not already exist.
* **If you are having trouble connecting to Salesforce:**
  * If you are having trouble connecting Salesforce to your GrowSurf campaign, the issue may be related to permissions. Contact your Salesforce administrator and ask them to enable API access in the 'Permission Sets' section. Keep in mind that API access is only available in certain Salesforce editions, including Enterprise, Unlimited, Developer, and Performance. It is not available in Group, Essentials, and Professional but can be added as a feature in the Professional edition. For more information, check out [Salesforce editions with API access](https://help.salesforce.com/s/articleView?id=000385436\&type=1).
