Skip to main content
Salesforce Object: wegive__Pledge__c (WeGive managed package object)
WeGive Model: Pledge

Overview

This document describes how pledge data syncs between WeGive and Salesforce. Pledges represent commitments from donors to give a certain amount over a specified period, typically broken into installments.
One legacy custom implementation uses a different object and field set, driven by mapping rules. Everything below describes the standard wegive__Pledge__c object shipped in the WeGive managed package.

How Pledge 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

  • Configurable (mapping rule) - Reaches Salesforce only when a mapping rule for it exists
  • Hard-coded - Built into the integration logic and cannot be changed

Sync Configuration

Pledge pulls and pushes are controlled by the Pull pledges and Push pledges toggles in Sync Configuration. Related settings:

Sync Triggers

From WeGive to Salesforce (Export)

Pledge data is exported when a pledge is created or updated in WeGive (e.g., amount changed, dates updated, description or hidden status changed). Pledge payments (transactions) do not trigger a pledge push.

From Salesforce to WeGive (Import)

  • Last Modified Date: WeGive polls wegive__Pledge__c for records modified since the last sync
  • Modified Field Tracking: Only pledges with a LastModifiedDate newer than the last successful sync are pulled

Deleted Pledges

When pull_deleted_pledges is enabled, pledges with IsDeleted = true in the sync window soft-delete the matching WeGive pledge.

Sync Process Overview

Pulling Data from Salesforce

The pull reads a fixed field set: Id, CreatedDate, Name, wegive__Account__c, wegive__Account__r.RecordType.Name, wegive__Contact__c, wegive__Amount__c, wegive__Campaign__c, wegive__Description__c, wegive__Start_Date__c, wegive__End_Date__c, wegive__Next_Installment_Date__c, wegive__Installment_Period__c, wegive__Is_Hidden__c. Import mapping rules do not change the pledge fields; any values not mapped to pledge attributes are stored as custom field values. The import:
  • Matches the WeGive pledge by stored salesforce_id, creating a new pledge if none exists
  • For new pledges only, resolves the donor from wegive__Contact__c and wegive__Account__c. If the Account’s Record Type is not the household Record Type it is treated as an Organization Account and the company donor is used; otherwise the Contact is used. The record fails with “No donor found” if neither resolves
  • Links the campaign matching wegive__Campaign__c
  • Converts the installment period (see Installment Frequency Mapping)
  • Writes description, hidden status, dates, amount and next installment date
Auto-bill lock. If the WeGive pledge has automatic billing enabled, WeGive owns the billing schedule and the import does not overwrite total_amount, start_date, end_date, installment_frequency, number_of_installments or next_installment_date. Description and hidden status are still updated. Pledges without auto-bill take all values from Salesforce.
Funds are not imported for pledges.

Pushing Data to Salesforce

Before pushing, the integration pushes the donor, campaign and fund if any of them lacks a Salesforce ID. The payload is then built from the hard-coded fields below plus any Pledge export mapping rules. The pledge’s attributes, custom fields, donor, campaign and fund attributes are available to rules.

Standard Field Mappings

Important Notes

Donor Association

On export, both wegive__Contact__c and wegive__Account__c are sent with whatever IDs the donor has. On import (new pledges only), the donor is resolved as follows:
  1. If wegive__Account__c is set and the Account’s Record Type is not the household Record Type (household_record_type_name, default “Household Account”), the company donor with that Account ID is used
  2. Otherwise, if wegive__Contact__c is set, the donor with that Contact ID is used
  3. Otherwise, if only an Account ID is present, the company donor with that Account ID is used
If no donor is found the import fails. Existing pledges keep their donor.

Installment Frequency Mapping

On import the match is case-insensitive and also accepts the bare values “1”, “4” and “8”. An unrecognised Salesforce value leaves the frequency empty. On export, a WeGive value not in the table is sent as-is.
Pledges share the same FREQUENCY_TO_SF/SF_TO_FREQUENCY constant maps as Recurring Donations — confirmed at Salesforce.php:84-103 (export) and :93-103 (import), referenced directly from compilePledgePayload() (:5948, :5995) and importPledge() (:3448-3451). There is no separate Pledge-specific frequency table; it is the identical mapping used for npsp__InstallmentFrequency__c on Recurring Donations.

Campaign and Fund

  • Campaign: exported to wegive__Campaign__c and imported from it. The campaign is pushed first if it has no Salesforce ID
  • Fund: the fund is pushed first if it has no Salesforce ID, but there is no fund field on wegive__Pledge__c. Fund is neither exported nor imported for pledges

Date Formatting

Start and end dates are exported as Y-m-d in the organization’s timezone.

Number of Installments

number_of_installments is not read from Salesforce. New pledges created by import get 0; existing pledges keep their current value.

Required Fields

For WeGive to Salesforce: a donor with a Contact or Account Salesforce ID, total amount, start date. For Salesforce to WeGive: wegive__Amount__c, and either wegive__Contact__c or wegive__Account__c matching an existing WeGive donor (new pledges).

Pledge Matching & Create/Update Logic

When WeGive Exports a Pledge to Salesforce

  • If the pledge has a salesforce_id: UPDATE the existing record
  • If not: acquire a per-pledge lock and CREATE a new record, then store its ID
Pledges are matched only by stored Salesforce ID.

When Salesforce Exports a Pledge to WeGive

  1. Search for an existing pledge by salesforce_id; update it, or create a new one
  2. For a new pledge, resolve the donor (see Donor Association); fail if not found
  3. Link the campaign if wegive__Campaign__c matches a WeGive campaign
  4. Apply the imported values, honoring the auto-bill lock

Payment Tracking

Standard wegive__Pledge__c carries no payment progress fields. Counts of paid installments, total paid, remaining balance, last and next donation date, and an Active/Closed status are pushed only by one legacy custom implementation and are not part of the managed package object. In WeGive, pledges track their transactions through the pledge_id field on the transaction, and a transaction imported from an Opportunity is linked to its pledge when a mapping rule supplies pledge.salesforce_id. Verified against the integration source, September 2026.