> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wegive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaign

> Mapping between WeGive Campaigns and Salesforce Campaigns

**Salesforce Object:** `Campaign` (standard object)<br />**WeGive Model:** Campaign

## Overview

This document describes how campaign data syncs between WeGive and Salesforce. Campaigns represent fundraising initiatives, events, appeals, or programs. They organize and track donations, drive communication with supporters, and measure fundraising success.

In NPSP, campaigns are a standard Salesforce object with enhanced functionality for tracking donors, donations, and campaign hierarchies.

***

## How Campaign Data Syncs

### Direction

* **Import from Salesforce** - Data imports from Salesforce into WeGive only
* **Export to Salesforce** - Data exports from WeGive to Salesforce only
* **Both Ways** - Data syncs in both directions

### Mapping Types

* **Hard-coded** - Built into the integration logic and cannot be changed
* **Configurable (mapping rule)** - Only synced when an integration mapping rule for the Campaign object targets the field. Nothing is sent or read for these fields by default.

***

## Sync Configuration

Campaign sync is controlled by the following integration toggles:

* **Pull campaigns** - Enables the scheduled import of Campaigns from Salesforce
* **Push campaigns** - Enables the export of WeGive campaigns to Salesforce
* **`pull_deleted_campaigns`** - When enabled, Campaigns deleted in Salesforce are also deleted (soft-deleted) in WeGive

***

## Sync Triggers

### From WeGive to Salesforce (Export)

Campaign data is exported from WeGive to Salesforce when:

* **Campaign Created:** A new campaign is created in WeGive
* **Campaign Updated:** An existing campaign is modified in WeGive

The export happens automatically after the create or update action in WeGive.

### From Salesforce to WeGive (Import)

Campaign data is imported from Salesforce to WeGive based on:

* **Last Modified Date:** WeGive periodically polls Salesforce for Campaigns whose `LastModifiedDate` falls in the window since the last sync. (The pull field defaults to `LastModifiedDate` and can be changed with the `pull_by` setting.)
* **Sync Frequency:** The integration checks for updated Campaigns on a scheduled basis (frequency varies by integration configuration)

This means:

* Creating a new Campaign in Salesforce will import it to WeGive on the next sync cycle
* Updating an existing Campaign in Salesforce will trigger an import to WeGive on the next sync cycle
* The sync is based on the record's modification timestamp, not individual field changes

### Deleted Campaigns

When `pull_deleted_campaigns` is enabled, the integration queries Salesforce for Campaigns with `IsDeleted = true` in the sync window. Any WeGive campaign whose `salesforce_id` matches is soft-deleted in WeGive.

Campaign deletions are not pushed from WeGive to Salesforce.

***

## Sync Process Overview

### Pulling Data from Salesforce

The import queries the Campaign object for `Id`, `CreatedDate`, and every Salesforce field referenced by an import-level mapping rule for campaigns. The import process:

* **Campaign Identification:** Finds the WeGive campaign with a matching `salesforce_id`, or creates a new one
* **Hierarchy Management:** If a mapping rule provides the parent campaign's Salesforce ID, the integration looks for a WeGive campaign with that `salesforce_id` and links it as the parent. If no such WeGive campaign exists yet, no parent link is set on this pass.
* **Mapped Fields:** Fills every field a mapping rule supplies (name, dates, goal, and so on)
* **Custom Fields:** Fills WeGive custom field values from mapped Salesforce fields
* **Metadata:** Stores the Salesforce `CreatedDate` as the WeGive created date

Imported values are written as received. The integration does not itself parse dates or convert dollar amounts on import.

### Pushing Data to Salesforce

When a Campaign is created or updated in WeGive, the integration compiles a payload for the Salesforce Campaign object. By default the payload contains only:

* `Name` - the WeGive campaign name
* `wegive__WeGive_Id__c` - the WeGive campaign ID

Every other field is added only when an export-level mapping rule for campaigns targets it. The data available to mapping rules includes all campaign attributes plus:

* `start_date` and `end_date`, formatted `Y-m-d` in the organization's timezone (UTC if none is set)
* `goal_dollars`, the WeGive goal converted from cents to dollars
* `parent_campaign`, the parent campaign's attributes (including `parent_campaign.salesforce_id`)
* Any WeGive custom field values, keyed by the custom field's API name

<Warning>
  The parent campaign is **not** pushed automatically. If a mapping rule maps `parent_campaign.salesforce_id` to `ParentId` and the parent has not yet been synced, the value resolves to empty and the child is created without a parent link. Sync parent campaigns before their children.
</Warning>

For organizations with a multi-entity Salesforce instance, the integration stamps `wegive__WeGive_Entity__c` on pushed campaigns and filters pulled campaigns by entity when the campaign domain is entity-scoped.

***

## Campaign Field Mappings

| Salesforce Field | WeGive Field | WeGive API Field | Direction | Type | Notes |
| :- | :- | :- | :- | :- | :- |
| Id | Salesforce ID | salesforce\_id | Import from Salesforce | Hard-coded | Salesforce's unique identifier for this campaign |
| CreatedDate | Created At | created\_at | Import from Salesforce | Hard-coded | When the campaign was created in Salesforce |
| Name | Campaign Name | name | Both Ways | Configurable import / Hard-coded export | Always sent on export; requires a mapping rule on import |
| wegive\_\_WeGive\_Id\_\_c | WeGive Campaign ID | id | Export to Salesforce | Hard-coded | Omitted for shared objects in multi-entity orgs |
| StartDate | Start Date | start\_date | Both Ways | Configurable (mapping rule) | Export value is `Y-m-d` in the organization's timezone |
| EndDate | End Date | end\_date | Both Ways | Configurable (mapping rule) | Export value is `Y-m-d` in the organization's timezone |
| ExpectedRevenue | Goal Amount | goal\_dollars | Both Ways | Configurable (mapping rule) | Export value is dollars (WeGive stores cents) |
| ParentId | Parent Campaign Salesforce ID | parent\_campaign.salesforce\_id | Both Ways | Configurable (mapping rule) | Parent is not auto-pushed |

<Note>
  The Salesforce field names shown for the configurable rows are the conventional targets. Your organization's mapping rules determine which Salesforce fields are actually used.
</Note>

***

## Important Notes

### Campaign Hierarchies

Campaigns in both WeGive and Salesforce support parent-child relationships. The integration maintains them as follows:

* **On import**, the parent link is set only if the parent already exists in WeGive with a matching `salesforce_id`. Otherwise the child is imported without a parent, and the link is not retroactively created until the child is modified again in Salesforce and re-imported.
* **On export**, the parent's `salesforce_id` is exposed to mapping rules. The parent is not pushed first; if it has no `salesforce_id`, the child is created without a parent reference.

### Date Formatting

On export, `start_date` and `end_date` are converted to the organization's timezone and formatted `Y-m-d`. Dates are optional and can be null for evergreen or ongoing campaigns. No date conversion is performed on import.

### Goal Amount Conversion

* **WeGive** stores the goal in cents as an integer (e.g., 50000 = \$500.00)
* **On export**, `goal_dollars` is the goal divided by 100
* **On import**, the Salesforce value is stored as provided by the mapping rule; the integration does not multiply by 100

***

## Campaign Matching & Create/Update Logic

### When WeGive Exports a Campaign to Salesforce

* If the WeGive campaign has a `salesforce_id`: the integration **UPDATES** the existing Campaign
* If no `salesforce_id` exists: the integration **CREATES** a new Campaign (a lock prevents two concurrent pushes from creating duplicates)

Campaigns are NOT matched by name or other criteria. Each WeGive campaign maps to exactly one Salesforce Campaign based solely on the stored Salesforce ID.

### When Salesforce Exports a Campaign to WeGive

* The integration searches for an existing WeGive campaign by `salesforce_id`
* If found, it updates that campaign; if not found, it creates a new one
* Mapped fields, the parent link (when resolvable), and custom field values are applied

***

## Integration Rules

Organizations can create mapping rules for campaigns to handle standard fields (dates, goal, parent) and any custom fields on the Campaign object. Rules are configured with:

* `crm` = 'salesforce'
* `integration` = 'campaign'
* `level` = 'import', 'export', or 'both'

***

## Required Fields

**For WeGive to Salesforce:**

* Name (always sent)

**For Salesforce to WeGive:**

* Id (automatically selected)

All other fields sync according to the mapping rules configured for your organization.

***

## Troubleshooting

**Campaign not syncing:**

* Verify the campaign has been modified since the last sync time
* Confirm the Pull campaigns / Push campaigns toggles are enabled
* Check that the integration has access to the Campaign object

**Parent campaign link missing:**

* Confirm the parent campaign exists in both systems with a `salesforce_id`
* Sync the parent before the child; the integration does not push parents automatically
* Confirm a mapping rule maps `parent_campaign.salesforce_id` to `ParentId`

**Dates or goal not appearing in Salesforce:**

* These fields are sent only through mapping rules; confirm rules exist for `start_date`, `end_date`, and `goal_dollars`

**Duplicate campaigns:**

* Campaigns are only matched by Salesforce ID; creating the same campaign in both systems will create duplicates

**Campaign disappeared from WeGive:**

* If `pull_deleted_campaigns` is enabled, deleting a Campaign in Salesforce soft-deletes it in WeGive

***

## Related Documentation

* [Campaign Member](./campaign-member)
* [Fundraiser](./fundraiser)

*Verified against the integration source, September 2026.*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.