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__cfor records modified since the last sync - Modified Field Tracking: Only pledges with a
LastModifiedDatenewer than the last successful sync are pulled
Deleted Pledges
Whenpull_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__candwegive__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
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, bothwegive__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:
- If
wegive__Account__cis 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 - Otherwise, if
wegive__Contact__cis set, the donor with that Contact ID is used - Otherwise, if only an Account ID is present, the company donor with that Account ID is used
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__cand 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 asY-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
When Salesforce Exports a Pledge to WeGive
- Search for an existing pledge by
salesforce_id; update it, or create a new one - For a new pledge, resolve the donor (see Donor Association); fail if not found
- Link the campaign if
wegive__Campaign__cmatches a WeGive campaign - Apply the imported values, honoring the auto-bill lock
Payment Tracking
Standardwegive__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.
Related Documentation
- Data Mapping Overview - object index and cross-cutting data conventions
- Opportunity & Payment - pledge payments as transactions
- Contact and Account - the pledging donor