> For the complete documentation index, see [llms.txt](https://docs.anedot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anedot.com/integrations/crm-donor-management/salesforce-npsp.md).

# Salesforce

Connect Anedot to Salesforce with or without NPSP to record donations, commitments, and Action Page submissions and updates as Salesforce records in your org.

**Salesforce** works with the Anedot package to record your donations, commitments, Action Page submissions, and Action Page updates as Salesforce records, whether your org uses the Nonprofit Success Pack (NPSP) or standard Salesforce objects. You connect it in **Settings > Integrations**, and this article covers choosing NPSP or standard Salesforce objects, connecting Anedot to Salesforce, managing your connection, reviewing data relays, using custom templates, setting up Anedot Mapping and Custom Metadata, and finding your data in Salesforce.

## Before You Begin

* You need **Integrations: Edit permissions** in Anedot to add, edit, push, or delete a connection. Integrations: Edit permissions also require **Action Pages: View** and **Integrations: View** permissions. See [Permission Sets](https://docs.anedot.com/settings/access/permission-sets.md).
* Your Salesforce user needs the **Download AppExchange Packages** permission to install the Anedot package.
* Your Salesforce org needs **My Domain** deployed, because Anedot uses your My Domain to connect. If you use NPSP, **Chatter** must also be turned on. The NPSP installer checks for both.
* The Salesforce user you connect with needs the permissions listed in [Required Salesforce Permissions](#required-salesforce-permissions).
* Test your setup in a Salesforce sandbox and an Anedot Sandbox account before connecting live data. Testing first confirms your configuration is set up correctly before real data from your live Anedot account flows into your Salesforce account. To request an Anedot Sandbox account, contact our Support team at <help@anedot.com>.

## NPSP Or Standard Salesforce Objects

Anedot uses one package and one Salesforce connection for every org. The **Source Object** setting in Anedot Settings, set to **NPSP** or **Salesforce**, tells the package which records to create. It's a manual setting, so choose the option that matches your org.

| Area                                                               | Source Object: NPSP                                                                                                                                                                                                                                                                                            | Source Object: Salesforce                                                                                                                                                                                                              |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Contacts and Household Accounts                                    | Contacts are matched by email first, then by payment method ID. If there's no match, a new Contact is created. NPSP's household settings handle the Account. If an Account named "\[Last name] Household" already exists, the package creates a separate Account named "\[First name] \[Last name] Household". | Contacts are matched by email first, then by payment method ID. If there's no match, a new Contact is created. Each new Contact gets a new Account named "\[Last name] Household".                                                     |
| Donations and GAUs                                                 | Each completed donation is recorded as an Opportunity. GAU Allocations are created for each donation's fund when **Create GAU Allocation Records** is checked.                                                                                                                                                 | Each completed donation is recorded as an Opportunity. No GAU Allocations are created.                                                                                                                                                 |
| Recurring Donations (with **Create Future Opportunities** checked) | A new commitment creates a Recurring Donation, open future Opportunities, and GAU Allocations.                                                                                                                                                                                                                 | A new commitment creates open future Opportunities. No Recurring Donation is created.                                                                                                                                                  |
| Commitment Updates                                                 | Updates the Recurring Donation and its Opportunities. When a commitment is canceled, the remaining open future Opportunities move to the **Opportunity Closed-Lost Stage**.                                                                                                                                    | Reschedules the close dates of the commitment's open future Opportunities, found by the commitment's submission. When a commitment is canceled, the remaining open future Opportunities move to the **Opportunity Closed-Lost Stage**. |
| Same Either Way                                                    | Campaigns, Campaign Members, submissions, Anedot Tickets, Anedot Donation Exceptions, and Anedot Mapping and Custom Metadata.                                                                                                                                                                                  | Same as NPSP.                                                                                                                                                                                                                          |

{% hint style="info" %}
Anedot sends the same payloads either way. **Source Object** only changes which records the package creates in Salesforce.
{% endhint %}

You'll choose **Source Object** in [Step 3](#step-3-set-up-the-anedot-package). Step 1 applies only to NPSP orgs.

## Connect Anedot to Salesforce

Connecting Anedot to Salesforce has four stages. You'll install NPSP if your org uses it, install the Anedot package in Salesforce, set up the package, and then connect Salesforce in Anedot.

### Step 1: Install NPSP (NPSP Orgs Only)

{% hint style="info" %}
If NPSP is already installed in your Salesforce org, or if you'll use standard Salesforce objects, skip to Step 2.
{% endhint %}

To install NPSP:

1. Go to the Salesforce NPSP installer at <https://install.salesforce.org/products/npsp/latest>.
2. Choose the **Install NPSP** plan.
3. Log in to the Salesforce org where you want to install NPSP.
4. Complete the prompts in the installer.

The installer checks that **My Domain** is deployed and **Chatter** is turned on, then installs NPSP in your org.

{% hint style="success" %}
Salesforce recommends installing NPSP in a sandbox or Developer Edition org first and testing it before you install in production.
{% endhint %}

### Step 2: Install the Anedot Package

The current version of the Anedot package is 1.9.0.1. To install the Anedot package:

1. Open the install link for your Salesforce org type:
   * **Production or Developer Edition org:** `https://login.salesforce.com/packaging/installPackage.apexp?p0=04tg7000000GeCpAAK`
   * **Sandbox org:** `https://test.salesforce.com/packaging/installPackage.apexp?p0=04tg7000000GeCpAAK`
2. If prompted, log in to the Salesforce org where you want to install the package.
3. Review the package components on the **Package Installation Details** page.
4. Choose **Install for All Users**.
5. Click **Install**.
6. If Salesforce asks you to approve third-party access, select **Yes, grant access to these third-party web sites**, then click **Continue**.
7. Wait for the installation to finish. This can take a few minutes.

Salesforce emails you a confirmation when the Anedot package is installed.

{% hint style="info" %}
The sandbox link installs the Anedot package into a Salesforce sandbox org.
{% endhint %}

#### Assign The Anedot Permission Set

The Anedot package includes two permission sets, **Anedot Create Access** and **Anedot Read Access**. On a new installation, assign the **Anedot Create Access** permission set to the Salesforce user you'll connect with in Anedot and to any other user who works with Anedot records.

To assign the Anedot Create Access permission set:

1. Go to **Setup**.
2. Enter "Permission Sets" in the **Quick Find** box.
3. Click **Anedot Create Access**.
4. Click **Manage Assignments**.
5. Click **Add Assignment**.
6. Select the user.
7. Follow the prompts to assign the permission set.

The selected user now has the **Anedot Create Access** permission set.

{% hint style="info" %}
Existing assignments carry over when you upgrade the package, so only a new installation or a newly added user needs the assignment.
{% endhint %}

### Step 3: Set Up the Anedot Package

The Anedot package adds an **Anedot** app to Salesforce with an **Anedot Settings** tab. Your org can have only one Anedot Settings record.

To set up the Anedot package:

1. Click the **App Launcher** (grid icon) in Salesforce.
2. Select **Anedot**.
3. Select the **Anedot Settings** tab.
4. Click **New**.
5. Choose your settings. See the Anedot Settings table below.
6. Click **Create**.

Your Anedot Settings record is saved. To change it later, open the record and click **Edit**.

#### Anedot Settings

| Setting                             | Options                                            | What It Does                                                                                                                                  |
| ----------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Source Object**                   | NPSP or Salesforce                                 | Choose NPSP if you use the Nonprofit Success Pack. Choose Salesforce for standard Salesforce objects.                                         |
| **Create GAU Allocation Records**   | Checkbox, checked by default. Shown for NPSP only. | Creates GAU Allocation records for each donation's fund.                                                                                      |
| **Default Campaign Member Status**  | Your org's Campaign Member statuses                | Status given to new Campaign Members.                                                                                                         |
| **Donation Amount Field**           | Total Donation Amount or Net Amount                | Which amount is saved on the Opportunity.                                                                                                     |
| **Integration Error Email Address** | Email address                                      | Receives notices about errors in the package.                                                                                                 |
| **Opportunity Closed-Won Stage**    | Your org's Opportunity stages                      | Stage for completed donations.                                                                                                                |
| **Opportunity Closed-Lost Stage**   | Your org's Opportunity stages                      | Stage given to remaining future Opportunities when a commitment ends.                                                                         |
| **Update Contact Info from Anedot** | Checkbox, unchecked by default                     | Updates existing Contacts with the donor's latest details from Anedot.                                                                        |
| **Create Future Opportunities**     | Checkbox, unchecked by default                     | Creates open future Opportunities when a commitment is created. With **Source Object** set to **NPSP**, it also creates a Recurring Donation. |
| **Default Campaign**                | Campaign lookup (optional)                         | Links records to one Campaign instead of a Campaign for each Action Page.                                                                     |
| **Single Donation Record Type**     | Your org's Opportunity record types                | Record type for one-time donation Opportunities.                                                                                              |
| **URL for webhook**                 | Filled in automatically                            | Your org's Anedot endpoint, for reference.                                                                                                    |

{% hint style="info" %}
Picklist options come from your own Salesforce setup, so they can differ from org to org.
{% endhint %}

### Step 4: Connect Salesforce in Anedot

To connect Salesforce in Anedot:

1. Go to **Settings > Integrations**.
2. Click **New integration**.
3. Choose **Salesforce**. You can find it under **CRM** or by entering "Salesforce" in the search box.
4. Choose the Action Page scope:
   * Keep **All Action Pages** checked to include every Action Page, including pages you add later. (Optional) In **Exclude Pages**, enter a comma-separated list of Action Page IDs with no spaces.
   * Uncheck **All Action Pages** and choose **Selected pages** to pick specific pages.
5. Leave **Team** set to **All teams**.
6. Enter the part of your Salesforce My Domain that comes before `.my.salesforce.com` in **Salesforce domain**:
   * For a production org at `https://yourorg.my.salesforce.com`, enter `yourorg`.
   * For a sandbox at `https://yourorg--sandboxname.sandbox.my.salesforce.com`, enter `yourorg--sandboxname.sandbox`.
7. (Optional) Enter a JSON template in **Template**. See [Custom Templates](#custom-templates).
8. Click **Continue to provider**.
9. Log in to Salesforce as the user Anedot should connect as.
10. Click **Allow**.

Anedot finishes the setup and returns you to **Settings > Integrations**, where your connection is listed as **Salesforce Integration**.

{% hint style="info" %}
Don't include `https://` in the domain. To find your My Domain, go to **Setup > Quick Find > My Domain** in Salesforce.
{% endhint %}

{% hint style="info" %}
Anedot builds your Salesforce endpoint from your domain, so you don't paste a URL into Anedot. The **URL for webhook** in Anedot Settings shows the same address for reference.
{% endhint %}

{% hint style="warning" %}
The template must be valid JSON, or Anedot won't save the connection.
{% endhint %}

### Required Salesforce Permissions

The Salesforce user you connect with needs Read, Create, and Edit permissions on these objects:

* **Recurring Donations** (NPSP only)
* **Contacts**
* **Opportunities**
* **Campaigns** and **Campaign Members**
* **GAU Allocations** (NPSP)
* **Accounts**

## Manage Your Connection

Each Salesforce connection in **Settings > Integrations** has **Edit**, **Push unsent**, and **Delete** actions.

To change the Action Page scope:

1. Go to **Settings > Integrations**.
2. Click **Edit** on your Salesforce connection.
3. Change the Action Page scope.
4. Click **Save integration**.

Anedot uses the new scope for records it sends from then on.

{% hint style="info" %}
To change the Salesforce domain or the template, or to connect as a different Salesforce user, delete the connection and connect again.
{% endhint %}

To delete a connection:

1. Go to **Settings > Integrations**.
2. Click **Delete** on your Salesforce connection.
3. Confirm when Anedot asks "Delete this integration?"

The connection is removed from your fundraising account.

**Push unsent** resends records that failed or were never sent, the same way it works for Webhooks:

* Choose a date range of up to 31 days.
* The start date must be within the last 12 months.
* Only failed or never-sent records are sent.
* Wait about five minutes between pushes.

For full steps, see [Push Unsent in Webhooks (API)](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#push-unsent).

## Data Relays

Every Salesforce connection sends all of these events. You can't turn individual events on or off.

* `submission_created`
* `donation_completed`
* `donation_refunded`
* `donation_partially_refunded`
* `donation_voided`
* `donation_chargeback`
* `donation_chargeback_reversed`
* `donation_ach_returned`
* `commitment_created`
* `commitment_updated`
* `commitment_failed_to_process`
* `action_page_created`
* `action_page_updated`
* `custom_field_created`
* `custom_field_updated`

Anedot doesn't send `donation_settled` to Salesforce. For a description of each event, see [Webhook Events](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#webhook-events).

Anedot waits briefly before sending some events:

* `donation_completed`: 15 seconds
* `commitment_created`: 30 seconds
* `commitment_updated`: 45 seconds

When one submission includes more than one donation, such as gifts to several Funds, each additional donation waits 5 more seconds.

Each request is an HTTPS POST with a JSON body of `{"event": "<event name>", "payload": {...}}`. Requests use the same headers as Webhooks, plus an `Authorization: Bearer` header with the connection's Salesforce access token. Anedot refreshes the access token before each request. See [Request Headers](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#request-headers).

The sections below describe what the Anedot package does with this data in Salesforce.

### Campaigns

Each Action Page becomes a **Campaign** in Salesforce. To link records to one Campaign instead, set **Default Campaign** in Anedot Settings. This helps when you group data by initiative or vendor, such as all Facebook donations under one Campaign named Anedot.

![Salesforce: Campaigns with default Campaign from Anedot Settings](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FXqOOsKjJ8mMpLG24LNjT%2Fsf-default-campaign.png?alt=media)

### Funds And GAUs

In NPSP, Anedot Funds map to **General Accounting Units (GAUs)**. With **Source Object** set to **NPSP**, the package creates or updates a GAU for each fund and creates GAU Allocation records for each donation by default. To turn this off, uncheck **Create GAU Allocation Records** in Anedot Settings. With **Source Object** set to **Salesforce**, the package doesn't create GAUs or GAU Allocations.

![Salesforce NPSP: General Accounting Units (GAUs)](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FKm5NZSOEogWNh1I3riHZ%2Fsf-gau.png?alt=media)

### Contacts

The package creates or links **Contacts** from Action Page submissions. It matches Contacts by email first, then by payment method ID. If there's no match, it creates a new Contact.

How a new Contact's Household Account is handled depends on **Source Object**:

* **Salesforce:** each new Contact gets a new Account named "\[Last name] Household".
* **NPSP:** NPSP's own household settings handle the Account. If an Account named "\[Last name] Household" already exists, the package creates a separate Account named "\[First name] \[Last name] Household".

The package also creates and links **Campaign Member** records, using the status set in **Default Campaign Member Status**.

To update existing Contacts with the donor's latest details from Anedot, check **Update Contact Info from Anedot** in Anedot Settings.

![Salesforce NPSP: Household Account Contacts and Opportunities](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FqYN4IW95MHu4XtHLlSCm%2Fsf-contacts.png?alt=media)

### One-Time Donations

One-time donations are recorded as Closed-Won **Opportunities**, using the stage set in **Opportunity Closed-Won Stage**. The Opportunity uses the amount chosen in **Donation Amount Field** and the record type set in **Single Donation Record Type**.

![Salesforce NPSP: One-time donation Opportunity](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2F3EhvkuOjuFx5xa5XV3uV%2Fsf-onetime-donation.png?alt=media)

### Recurring Donations

How commitments appear in Salesforce depends on **Source Object** and the **Create Future Opportunities** setting.

When **Create Future Opportunities** is checked:

* With **Source Object** set to **NPSP**, a new commitment creates a **Recurring Donation**, open future **Opportunities**, and GAU Allocations.
* With **Source Object** set to **Salesforce**, a new commitment creates open future **Opportunities**. No Recurring Donation is created.
* Commitment updates, such as amount or frequency changes, sync to the Recurring Donation and its Opportunities in NPSP. With the Salesforce setting, the commitment's open future Opportunities get new close dates based on the next payment date and frequency.
* When a commitment is canceled, the remaining open future Opportunities move to the stage set in **Opportunity Closed-Lost Stage** with either setting. In NPSP, this also happens when a commitment is deactivated, and the Recurring Donation is closed.
* In NPSP, when a commitment ends or fails, the Recurring Donation is marked "Fixed" and the **Open Ended Status** field is set to "None".

When **Create Future Opportunities** is unchecked, each recurring payment is recorded as its own Opportunity when it completes, like a one-time donation. This works the same with either setting.

![Salesforce NPSP: Recurring Donation with future Opportunities](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FmdQg8uxeDQekhw4msqMT%2Fsf-commitment-events.png?alt=media)

### Submissions

Submissions work with either **Source Object** setting, **NPSP** or **Salesforce**. Each submission creates or updates a Contact, matched by email, then by payment method ID, and adds the Contact as a Campaign Member of the Action Page's Campaign or the Default Campaign.

![Salesforce NPSP: Submissions matched to Contacts](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FfI6Yp9U1xQZLB5BU2sXj%2Fsf-submissions.png?alt=media)

### Event Page Tickets

When a submission includes Event Page tickets, the Anedot package creates an **Anedot Ticket** record for each ticket, including free tickets.

* Each ticket record is linked to the Contact and to the Action Page's Campaign.
* Ticket records store the attendee name, email, phone, ticket type, ticket group, price, and check-in time.
* A ticket that's sent again updates the same **Anedot Ticket** record instead of creating a duplicate.
* Tickets aren't linked to an Opportunity.
* Tickets appear in the **Anedot Tickets** tab of the Anedot app.

To see tickets on Contact and Campaign records, add the **Anedot Tickets** related list to your page layouts.

To add the Anedot Tickets related list:

1. Go to **Setup**.
2. Click **Object Manager**.
3. Choose **Contact** or **Campaign**.
4. Click **Page Layouts**.
5. Open the page layout you want to edit.
6. Drag **Anedot Tickets** from **Related Lists** onto the layout.
7. Click **Save**.

The **Anedot Tickets** related list now appears on records that use that page layout. Repeat these steps for the other object if you want tickets on both Contact and Campaign records.

### Reversed Transactions

These events create an **Anedot Donation Exception** record in Salesforce:

* `donation_refunded`
* `donation_partially_refunded`
* `donation_voided`
* `donation_chargeback`
* `donation_chargeback_reversed`
* `donation_ach_returned`
* `commitment_failed_to_process`

Each exception includes the event, event amount, net amount, and Anedot submission ID. When the package finds the related Opportunity, it links the exception to it and updates the Opportunity's **Description** to point to the exception.

{% hint style="info" %}
The Opportunity's stage and amount aren't changed when a transaction is reversed. Review the Anedot Donation Exception to update the Opportunity as needed.
{% endhint %}

### Gift Of Any Amount Products

To send [Gift Of Any Amount (GOAA)](https://docs.anedot.com/action-pages/advanced-features/gift-of-any-amount.md) products to Salesforce, create a custom Anedot Mapping on the `submission_created` event and map it to your Salesforce product fields. See [Anedot Mapping and Custom Metadata](#anedot-mapping-and-custom-metadata).

### Delivery And Retries

Salesforce connections use the same delivery rules as Webhooks:

* A 2xx response from Salesforce counts as delivered.
* Failed requests retry automatically after 1 minute, then 2, then 3, adding a minute each time.
* The connection stops sending after 1,000 failed attempts in a row, or after 10 if Salesforce returns `404` or can't be reached. A successful request resets the count. The count also resets every Sunday at 1:00 AM Central Time for connections that are still sending.
* Users with the **Integration sync failed** notification turned on get an email when a request fails. See [Notifications](https://docs.anedot.com/get-started/security/notifications.md).
* Every request is logged in **Settings > Integrations > Integration Requests** with its status, request, and response. See [Integration Requests](https://docs.anedot.com/integrations/relay-data-troubleshooting/integration-requests.md).

When the connection stops sending after too many failed attempts, Anedot emails Owners, Super Admins, Admins, and users who have **Integrations: Edit permissions**. This email doesn't depend on notification settings, and it's separate from the **Integration sync failed** email. The subject is "Anedot Salesforce Integration Webhook Deactivated." The email names the connection, the account, and the destination host, asks you to review the errors under **Integrations**, and lists <help@anedot.com>.

A stopped connection can still show as enabled in the Integrations list, with **Enabled** checked. To start it sending again, follow the steps in Connection Stops Sending below.

For details, see [Retries](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#retries) and [When a Webhook Stops Sending](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#when-a-webhook-stops-sending).

## Custom Templates

A custom template adds fields to what Anedot sends to Salesforce. You enter it in **Template** when you connect Salesforce in Anedot.

* Anedot merges your template on top of the full default payload.
* Keys in your template are added to the payload.
* A key with the same name as a default field replaces that field's value.
* Default fields are never removed or renamed.
* The template applies to every event the connection sends.

Template tokens work the same as in Webhooks. Use `{{field_name}}` inside a string and `"<<object_name>>"` for objects. See [Custom Templates in Webhooks (API)](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#custom-templates).

This template adds `donation_method` and `stage` with fixed values and an empty `prefix`:

```json
{"donation_method": "CREDIT CARD", "stage": "RECEIVED", "prefix": ""}
```

{% hint style="warning" %}
To store template values in Salesforce, add matching Custom Metadata and an Anedot Mapping for each field. See [Anedot Mapping and Custom Metadata](#anedot-mapping-and-custom-metadata).
{% endhint %}

## Anedot Mapping and Custom Metadata

**Anedot Mapping** connects Anedot relay fields, by Event Type, to Salesforce fields, by Object Type. **Custom Metadata** defines which Anedot fields are available to map.

* **Event Types:** `donation_completed`, `commitment_created`, `commitment_updated`, `submission_created`, `action_page_created`, `action_page_updated`
* **Object Types:** Contact, Opportunity, Recurring Donation (NPSP only), Campaign Member

Default Anedot Fields are included in Custom Metadata when you install the Anedot package. Each field from a custom template needs its own Custom Metadata and Anedot Mapping.

{% hint style="info" %}
If you only map default fields, skip to [Set Up Anedot Mapping](#set-up-anedot-mapping). Custom Metadata is only needed for fields that aren't included by default.
{% endhint %}

### Create Custom Metadata in Salesforce

To create Custom Metadata:

1. Go to **Setup > Custom Metadata Types** in Salesforce.
2. Click **Anedot Field**.

   ![Salesforce Setup: Custom Metadata Types Anedot Field](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FFZ0mjCMnntaI0OBHhFcO%2Fsf-metadata-2.png?alt=media)
3. Click **Manage Anedot Fields**.

   ![Salesforce Setup: Manage Anedot Fields](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FPGXl6mLtg0tWnRQut0jm%2Fsf-metadata-3.png?alt=media)
4. Click **New**.

   ![Salesforce Setup: New Anedot Field custom mapping](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2F2xmBtDCTD1V5nivDpUCx%2Fsf-metadata-4.png?alt=media)
5. Enter the field details:

   ![Salesforce Setup: Anedot Field required fields form](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FHqfufUayTqLpHSHzTxIs%2Fsf-metadata-5.png?alt=media)

   * **Label:** a friendly name, such as `custom_prefix_label`.
   * **Field Name:** the API name, such as `custom_prefix`.
   * **Data Type:** the type of field, such as Text or Number.
   * **Event Type:** the event that carries the value.
   * **Path:** the dot path to the value in the payload, such as `payload.prefix`. Salesforce may suggest a path after you pick the Event Type. Confirm it before you save.
6. Click **Save**.

Your new field is available as an **Attribute** in Anedot Mapping.

### Set Up Anedot Mapping

To set up Anedot Mapping:

1. Open the **Anedot** app from the **App Launcher**.
2. Go to **Anedot Mapping**.
3. Select the **Target Object** from the dropdown in the upper right.

   ![Anedot Mapping: select Target Object](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FTVCrAKl6tZprgUPPfA17%2Fsf-anedot-mapping-2.png?alt=media)
4. Click **Create New Field Mapping**.

   ![Anedot Mapping: Create New Field Mapping](https://1576281756-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuNikYKWprVDzRjF4GER%2Fuploads%2FJ1mo5FUcBcd3H8BuKsNj%2Fsf-anedot-mapping-4.png?alt=media)
5. Choose the mapping details:
   * **Event Type:** the event that carries the value, such as `donation_completed`.
   * **Attribute:** the Anedot field, from your Custom Metadata fields.
   * **Salesforce Field:** the field where Salesforce stores the value.
6. Click **Save**.

Salesforce stores the Anedot value in the field you chose each time that event is received.

## Find Your Data in Salesforce

After Anedot sends data, you'll find it in these Salesforce records:

* **Campaigns:** one for each Action Page, or your Default Campaign.
* **Contacts:** donors and submitters from your Action Pages.
* **Opportunities:** one-time donations, recurring payments, and future payments.
* **Recurring Donations:** commitments, when **Create Future Opportunities** is checked (NPSP only).
* **GAU Allocations:** the Funds each donation was given to (NPSP only).
* **Campaign Members:** Contacts linked to each Campaign.
* **Anedot Donation Exceptions:** reversed transactions, in the **Anedot Donation Exceptions** tab of the Anedot app.
* **Anedot Tickets:** Event Page tickets, in the **Anedot Tickets** tab of the Anedot app.

## Field Mapping

Salesforce payloads use the same fields as Webhooks for each record type, plus a few Salesforce-specific fields.

| Record Type   | Events                                                                     | Fields                                                                                                                    |
| ------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Submissions   | `submission_created`                                                       | See [Submission Fields](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#submission-fields). |
| Donations     | `donation_completed` and reversal events                                   | See [Donation Fields](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#donation-fields).     |
| Commitments   | `commitment_created`, `commitment_updated`, `commitment_failed_to_process` | See [Commitment Fields](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#commitment-fields). |
| Action Pages  | `action_page_created`, `action_page_updated`                               | `id`, `name`, `funds` (list of `id`, `name`, `percentage`)                                                                |
| Custom fields | `custom_field_created`, `custom_field_updated`                             | `id`, `label`, `input_type`, `internal_name`                                                                              |
| All payloads  | Every event                                                                | `cancellation_reason`, `changed_attributes` (empty unless a commitment was canceled or changed)                           |

{% hint style="success" %}
To see the default Anedot Fields for each event in Salesforce, go to **Setup > Custom Metadata Types > Anedot Field > Manage Anedot Fields**.
{% endhint %}

## Payload Data

For request headers, see [Request Headers](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#request-headers).

### Request Body (Donation Completed)

This example is shortened. The full field list for each record type is in [Field Mapping](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#field-mapping) and [Payload Data](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md#payload-data) in Webhooks (API).

```json
{"event": "donation_completed", "payload": {"donation": {"id": "d5ea20f9421b0fb55499c"}, "email": "donor@example.com", "first_name": "Jane", "last_name": "Doe", "event_amount": "100.00", "net_amount": "95.70", "action_page_id": "469627e5-adac-4348-8191-080a060e2379", "action_page_name": "General Fund", "submission_id": "7c7d869c-436b-429b-ac68-69658f1d12eb", "cancellation_reason": null, "changed_attributes": null}}
```

### Action Page Updated

```json
{"event": "action_page_updated", "payload": {"id": "469627e5-adac-4348-8191-080a060e2379", "name": "General Fund", "funds": [{"id": "75bb50a0-69f3-4f98-8f6b-ac67fc1b1764", "name": "General Fund", "percentage": 100}], "cancellation_reason": null, "changed_attributes": null}}
```

### Custom Field Created

```json
{"event": "custom_field_created", "payload": {"id": "fd9e7338-9b1b-45eb-8644-1fa8fd47d18a", "label": "Would you like to subscribe to our newsletter?", "input_type": "question", "internal_name": "would_you_like_to_subscribe_to_our_newsletter_", "cancellation_reason": null, "changed_attributes": null}}
```

### Authentication Failure

If Anedot can't get an access token from Salesforce, the request is logged in **Settings > Integrations > Integration Requests** as failed with response status `401` and a body like this:

```json
{"error": "Authentication failed, check username, password and security token"}
```

## Troubleshooting

### Authentication Failures

A `401` response in **Settings > Integrations > Integration Requests** means Anedot couldn't get an access token from Salesforce.

To check the connected user in Salesforce:

1. Go to **Setup** in Salesforce.
2. Enter "Login History" in the **Quick Find** box, or open the connected user's record.
3. Look for failed logins or a password lockout for the connected user.

If the user was frozen, deactivated, locked out, or lost access, fix the user in Salesforce. Then delete the connection in Anedot and connect again.

### Setup Doesn't Finish

If Anedot shows "OAuth setup failed" or "OAuth setup is missing information", setup was interrupted. Start again from **New integration** in **Settings > Integrations**.

### Records Don't Appear in Salesforce

If requests show as successful in Anedot but records don't appear in Salesforce:

* Check your Salesforce data storage. If your org reaches its data storage limit, Salesforce can't create new records, so the Anedot package can't save new records sent from Anedot. Go to **Setup**, enter "Storage Usage" in the **Quick Find** box, and review the data storage used against your limit. Delete older or unneeded records to free up space.
* Check the inbox for your **Integration Error Email Address** for error notices from the Anedot package.

### Connection Stops Sending

If your Salesforce connection stops sending, check **Settings > Integrations > Integration Requests** to see why the requests failed. The connection can still show as enabled, with **Enabled** checked.

If the Integration Requests rows show a `401` status, follow the steps in [Authentication Failures](#authentication-failures). Saving the connection won't keep it sending until the Salesforce user is fixed and the connection is made again.

If sending stopped after too many failed requests for another reason, fix the cause first. Then:

1. Go to **Settings > Integrations**.
2. Open your Salesforce connection.
3. Click **Save integration**. You don't need to change any other fields.

Saving starts the connection sending again. After that, use **Push unsent** to send the events you missed.

If you need help, contact our Support team at <help@anedot.com>.

## Related Articles

* [Integrations](https://docs.anedot.com/integrations.md)
* [Webhooks (API)](https://docs.anedot.com/integrations/integration-automation-tools/webhooks.md)
* [Integration Requests](https://docs.anedot.com/integrations/relay-data-troubleshooting/integration-requests.md)
* [Notifications](https://docs.anedot.com/get-started/security/notifications.md)
* [Commitments](https://docs.anedot.com/finance/management-and-reporting/commitments.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.anedot.com/integrations/crm-donor-management/salesforce-npsp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
