Flow Name: Sync Subscription With Updated Charged Order Frequency¶
Last Updated: 2025-10-22 Source Code: Sync_Subscription_With_Updated_Charged_Order_Frequency.flow-meta.xml
API Name: Sync_Subscription_With_Updated_Charged_Order_Frequency Status: Active Type: Custom Trigger: Record-Triggered (Chargent Order - After Save Update)
Business Purpose¶
This flow automatically synchronizes PAC (Political Action Committee) subscription records when members change their contribution frequency, ensuring subscription products, frequencies, and renewal dates remain aligned with payment processing schedules.
Process Flow¶
- Frequency Change Detection: Triggers when Payment_Frequency__c changes on active recurring Chargent Order
- Subscription Lookup: Finds related active Subscription record
- Frequency Check: Determines new frequency (Monthly, Quarterly, or Annual)
- Product Lookup: Retrieves appropriate PAC product ID based on frequency
- Subscription Update: Updates Product, Frequency, and End Date fields
- Error Handling: Catches and reports update failures with detailed messages
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: Frequency Changed]) --> Check{Status=Recurring<br/>& Frequency Changed?}
Check -->|No| End([End])
Check -->|Yes| GetSub[Get Active Subscription]
GetSub --> SubFound{Subscription Found?}
SubFound -->|No| End
SubFound -->|Yes| CheckFreq{New Frequency?}
CheckFreq -->|Monthly| GetMonthly[Get Monthly Product<br/>P-PAC-998]
CheckFreq -->|Quarterly| GetQuarterly[Get Quarterly Product<br/>P-PAC-997]
CheckFreq -->|Annual| GetAnnual[Get Annual Product<br/>P-PAC-032]
CheckFreq -->|Other| UpdateDefault[Update Subscription<br/>No Product Change]
GetMonthly --> UpdateMonthly[Update: Product, Frequency=Monthly, End Date]
GetQuarterly --> UpdateQuarterly[Update: Product, Frequency=Quarterly, End Date]
GetAnnual --> UpdateAnnual[Update: Product, Frequency=Annuall, End Date]
UpdateMonthly --> UpdateSub[Update Subscription]
UpdateQuarterly --> UpdateSub
UpdateAnnual --> UpdateSub
UpdateDefault --> UpdateSub
UpdateSub --> Success{Update Success?}
Success -->|Yes| End
Success -->|No| Error[Show Custom Error]
Error --> End
style Start fill:#e1f5ff
style Check fill:#fff4e1
style SubFound fill:#fff4e1
style CheckFreq fill:#fff4e1
style Success fill:#fff4e1
style UpdateSub fill:#ffe1e1
style Error fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- Trigger Conditions:
- Payment Frequency changed
- Payment Status = "Recurring"
- Both old and new frequency values differ
- Product Mapping (by SKU):
- Monthly → P-PAC-998
- Quarterly → P-PAC-997
- Annual → P-PAC-032
- Subscription Updates:
- Product__c: Set to frequency-appropriate PAC product
- Frequency__c: Set to match Chargent Order frequency
- End_Date__c: Set to Next Scheduled Payment date
- Active Only: Only updates subscriptions with Status__c = "Active"
- Single Subscription: Updates only one subscription per Chargent Order
Dependencies¶
- ChargentOrders Package: ChargentOrder object
- Custom Objects: Subscription__c
- Standard Objects: Product2
- PAC Products: Three active products with specific SKUs (P-PAC-998, P-PAC-997, P-PAC-032)
Changes¶
No specific PR references found in the flow description or comments.
Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Typo in Frequency Value: "Annuall" should be "Annual" (line 50 in flow) - will cause reporting/filtering issues
HIGH - Address Soon After Go-Live¶
- Product Dependency: Hardcoded SKUs; if products are deleted/deactivated, flow fails
- No Validation: Doesn't verify products exist before attempting update
- Single Subscription Assumption: Uses getFirstRecordOnly; doesn't handle multiple subscriptions
MEDIUM - Future Enhancement¶
- Error Notification: Custom error only visible in flow interview details; no admin notification
- Frequency Values: Hardcoded frequency strings; should use picklist values or metadata
- End Date Logic: Assumes Next Scheduled Payment is appropriate end date; may need business validation
- Product Lookup Optimization: Makes separate product lookup for each frequency; could be consolidated
LOW - Monitor¶
- Inactive Products: Query filters for active products but doesn't handle scenario where product is inactive
- Frequency Edge Cases: Doesn't handle custom/non-standard frequency values
- Multiple Changes: If frequency changes multiple times quickly, may cause race conditions
Maintenance Notes¶
Complexity: Medium - Multiple decision paths with product lookups and frequency-based logic
Review Schedule: Bi-annual review recommended to ensure PAC product SKUs remain current
Testing Requirements: - Test frequency change from Monthly to Quarterly - Test frequency change from Quarterly to Annual - Test frequency change from Annual to Monthly - Test with non-PAC subscriptions (should not be affected) - Test with inactive subscriptions (should not update) - Test with missing PAC products (should error) - Verify End Date updates correctly - Test typo impact ("Annuall" vs "Annual") - Verify only active subscriptions are updated - Test with Chargent Orders that have no subscriptions