Recurring post-upsert flow
Note
This flow is self-documenting and should be viewed within Salesforce (Setup > Process Automations > Flows). This document is to support working through a visual flow. Please note: the flow commentary is produced using AI.
Overview#
Flow name: MoveData_Donation_Recurring_Post Label: [MoveData] Donation: Recurring - Post Upsert Type: Auto-Launched Flow Template API version: 60.0 Status: Active
This flow handles post-processing operations after recurring donation records are created or updated in Nonprofit Cloud, focusing on Gift Commitment Schedule management, status synchronisation, and gift designation processing.
Purpose#
The flow performs post-upsert operations that:
- Create and manage Gift Commitment Schedules for recurring donations
- Synchronise Gift Commitment status with external platform status
- Process gift designations from campaigns or overrides
- Handle payment method configuration and frequency settings
- Manage outreach source code associations
Salesforce fields#
This flow interacts with the Nonprofit Cloud Gift Commitment object and its related fields. Below is a mapping of all fields utilised:
| Field API name | Field type | Purpose in flow |
|---|---|---|
| Id | ID | Unique record identifier |
| Status | Picklist | Gift Commitment status field |
| CampaignId | Lookup | Associated campaign reference |
Input variables#
Core recurring donation data#
| Variable | Type | Required | Description |
|---|---|---|---|
Record |
GiftCommitment | Yes | The Gift Commitment record that was processed |
DonationCampaign |
Campaign SObject | No | Associated campaign for the recurring donation |
Amount |
Currency | No | Transaction amount for the commitment |
Status |
String | No | External platform status |
Date and schedule configuration#
| Variable | Type | Description |
|---|---|---|
StartDate |
DateTime | Schedule start date |
NextPaymentDate |
DateTime | Next scheduled payment date |
ModifiedAt |
DateTime | Last modification timestamp |
Donation_StartDate |
DateTime | Original donation start date |
Frequency and payment settings#
| Variable | Type | Description |
|---|---|---|
Frequency |
String | Payment frequency (daily/weekly/monthly) |
FrequencyUnit |
Number | Frequency multiplier |
FrequencyInterval |
String | Frequency interval type |
Donation_CardInformationType |
String | Payment method type (credit card/paypal) |
Fee processing#
| Variable | Type | Description |
|---|---|---|
FeePlatform |
Currency | Platform processing fee |
FeePlatformPublic |
Currency | Public platform fee |
Donation_FeePlatform |
Currency | Donation-specific platform fee |
Donation_FeePlatformPublic |
Currency | Donation-specific public fee |
Marketing and source tracking#
| Variable | Type | Description |
|---|---|---|
Donation_Marketing_Source |
String | Marketing source code for attribution |
Configuration variables#
| Variable | Type | Default | Description |
|---|---|---|---|
Config_DonationAmountSubtractFeePlatform |
Boolean | false | Subtract platform fees from amount |
Config_DonationGiftDesignationsCache |
Boolean | true | Enable gift designation caching |
Config_DonationSuppressGiftDesignations |
Boolean | false | Suppress gift designation processing |
Config_MarketingSuppressSource |
Boolean | false | Suppress marketing source processing |
Config_RecurringCommitmentContinueOnErr |
Boolean | true | Continue processing on errors |
Gift designation override#
| Variable | Type | Description |
|---|---|---|
Override_GiftDesignationId |
String | Override gift designation ID |
Flow logic#
1. Status determination and schedule type configuration#
The flow first determines the appropriate Gift Commitment Schedule status and type based on the input status:
Status mapping:
IF Status = "complete" OR "cancelled" THEN
GCS_Status = "Closed"
GCS_Type = "CreateTransactions"
ELSE IF Status = "failed" THEN
GCS_Status = "Lapsed"
GCS_Type = "CreateTransactions"
ELSE IF Status = "paused" THEN
GCS_Status = "Paused"
GCS_Type = "PauseTransactions"
ELSE
GCS_Status = "Active"
GCS_Type = "CreateTransactions"
2. Start date resolution#
The flow prioritises start dates in the following order:
- Donation start date - If
Donation_StartDateis provided - Modified date - If
ModifiedAtis provided - Start date - If
StartDateis provided - Default - Uses current processing date
All dates are converted to local time using the ConvertToLocalDateFlowComponent.
3. Payment schedule configuration#
Day calculation:
Day = DAY(StartDate)
IF Day > 30 THEN Day = "30"
Next payment date processing: If NextPaymentDate is provided:
- Convert to local time
- Extract day of month for scheduling
4. Transaction period and frequency mapping#
Standard frequencies:
- Daily:
GCS_TransactionPeriod = "Daily",GCS_TransactionInterval = 1 - Weekly:
GCS_TransactionPeriod = "Weekly",GCS_TransactionInterval = 1 - Monthly:
GCS_TransactionPeriod = "Monthly",GCS_TransactionInterval = 1 - Quarterly:
GCS_TransactionPeriod = "Monthly",GCS_TransactionInterval = 3 - Yearly:
GCS_TransactionPeriod = "Yearly",GCS_TransactionInterval = 1
Dynamic frequencies: When FrequencyUnit and FrequencyInterval are provided:
- Map
FrequencyIntervalto appropriate period (day/week/month/year) - Set
GCS_TransactionIntervaltoFrequencyUnitvalue - Default to "Custom" period if mapping fails
5. Payment method determination#
IF Donation_CardInformationType = "paypal" THEN
GCS_PaymentMethod = "PayPal"
ELSE
GCS_PaymentMethod = "Credit Card"
6. Amount calculation with fee processing#
AmountCalculated = IF Config_DonationAmountSubtractFeePlatform = true
THEN Amount - FeePlatformCalculated
ELSE Amount
FeePlatformCalculated = COALESCE(FeePlatformPublic, FeePlatform, Donation_FeePlatformPublic, Donation_FeePlatform, 0)
7. Campaign and source code processing#
Campaign association: If Record.CampaignId is populated, set GCS_CampaignId for the schedule.
Outreach source code resolution:
- Skip if
Config_MarketingSuppressSource = true - Use
GetOutreachSourceCodeComponentto matchDonation_Marketing_Source - Set
GCS_OutreachSourceCodeif match found
8. Gift Commitment Schedule management#
Schedule creation:
GiftCommitmentScheduleComponent Parameters:
- Mode: "Create"
- GiftCommitmentId: Record.Id
- All configured schedule parameters
Result processing:
- Track original schedule ID if different from new schedule
- Add both original and new schedule IDs to result list
- Handle success/failure scenarios
9. Gift Commitment status synchronisation#
The flow updates the Gift Commitment record status to match the schedule status:
Status updates:
IF Status = "closed/complete/cancelled" AND Record.Status != "Closed" THEN
Record.Status = "Closed"
ELSE IF Status = "failed" AND Record.Status != "Lapsed" THEN
Record.Status = "Lapsed"
ELSE IF Status = "paused" AND Record.Status != "Paused" THEN
Record.Status = "Paused"
ELSE IF Status = "success/active" AND Record.Status != "Active" THEN
Record.Status = "Active"
10. Gift designation processing#
Designation source priority:
- Override: Use
Override_GiftDesignationIdif provided - Campaign: Copy designations from
DonationCampaignif available - Default: Apply default gift designations
Processing control: Skip gift designation processing if Config_DonationSuppressGiftDesignations = true.
Error handling#
Validation failures#
- Schedule creation failures: Captured in
ScheduleErrorMessageand added toErrorscollection - Status update failures: Logged separately with failure context
- Apex component failures: Fault connectors capture and process errors
Continuation logic#
When Config_RecurringCommitmentContinueOnErr = true, the flow continues processing even after encountering errors, collecting all error messages for final reporting.
Dependencies#
ConvertToLocalDateFlowComponent(Date/time conversion)GetOutreachSourceCodeComponent(Source code matching)GiftCommitmentScheduleComponent(Schedule management)CopyGiftDesignationsComponent(Gift designation processing)WriteToLogFlowComponent(Logging operations)