Skip to content

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_Donation_Duplicate Label: [MoveData] Donation: Donation - Record Match Type: Auto-Launched Flow Template API version: 60.0 Status: Active

This flow performs sophisticated duplicate detection for donation records by using platform keys and recurring donation relationships to identify existing opportunities in Salesforce. It handles both direct donation matching and recurring donation child opportunity matching.

Purpose#

The flow attempts to find an existing Opportunity record for a donation to support update operations. It performs a prioritised matching strategy including:

  • Match against a platform key through the related Campaign's md_Platform_Key__r.md_Platform_Key__c if the external donation has the Campaign.external_id value set
  • Match against a platform key through the Primary Contact's md_Platform_Key__r.md_Platform_Key__c if the external donation has Primary_Contact.external_id value set
  • Check if this is a parent recurring Opportunity that already has a campaign relationship

Salesforce fields#

This flow interacts with Salesforce objects to match existing records. Below is a mapping of all fields utilised:

Field API name Field type Purpose in flow
Campaign.md_Platform_Key__c Lookup Platform key relationship for campaign matching
Contact.md_Platform_Key__c Lookup Platform key relationship for contact matching
Opportunity.CampaignId Lookup to Campaign Links opportunity to campaign for parent matching
npsp__Recurring_Donation__c Lookup Recurring donation parent relationship

Input variables#

Core matching data#

Variable Type Required Description
PlatformKey String No Generated platform key for direct opportunity lookup
ParentKey String No Parent recurring donation identifier for child matching
Platform String No Platform identifier (used with ParentKey)
StartDate DateTime No Donation start date for recurring child matching
Amount Currency No Donation amount (for context/logging)
Status String No Donation status (for context/logging)

Configuration variables#

Variable Type Default Description
Config_DonationRecurringOffsetDays Number 5 Days offset for recurring child opportunity date matching
Config_DonationRecurringPendingState String "Pledged" Stage name for pending recurring donation opportunities

Output variables#

Variable Type Description
Result String Salesforce Record ID of matching opportunity (if found)

Flow logic#

1. Platform key direct matching#

The flow first attempts direct platform key matching:

Condition: Platform key is provided Action: Query Opportunity records where movedata__Platform_Key__c equals the provided platform key Result: Returns matching opportunity ID if found

2. Recurring donation child matching#

If no direct match is found and parent key is provided:

Conditions:

  • No result from direct matching
  • ParentKey is provided (indicating this is a recurring donation child)

Process:

  1. Generate recurring platform key: Calls MoveData_Donation_Recurring_Key subflow
  2. Find parent recurring donation: Queries recurring donation by platform key
  3. Find pending child opportunity: Searches for existing pending opportunities

The recurring child opportunity search uses sophisticated date and status matching:

Query filters:

  • Recurring donation: npe03__Recurring_Donation__c = RecurringObjectId
  • Stage: StageName = Config_DonationRecurringPendingState
  • Date range: CloseDate between calculated offset dates
  • Sort order: Ascending by CloseDate (returns earliest match)

Date range calculation:

OffsetDate1 = DATEVALUE(StartDate) - Config_DonationRecurringOffsetDays
OffsetDate2 = DATEVALUE(StartDate) + Config_DonationRecurringOffsetDays

Error handling#

Missing data scenarios#

  • No platform key: Flow skips direct matching, proceeds to recurring logic
  • No parent key: Flow terminates after direct matching attempt
  • No start date: Date offset formulas return null, no date filtering applied
  • No recurring parent found: Flow logs but continues processing

Data quality validation#

The flow handles various data quality issues:

  • Null values: Graceful handling of missing optional parameters
  • Invalid dates: Formula protection against invalid date values
  • Missing configuration: Uses default values where appropriate

Dependencies#

  • MoveData_Donation_Recurring_Key (Subflow)
Ask MoveData AI
Ask about setup, configuration, or troubleshooting
How can I help you with MoveData today?