Skip to content

Flow Name: Update Dues Paid Thru Date on the Account

Last Updated: 2025-07-28 Source Code: Update_Dues_Paid_Thru_Date_on_the_Account.flow-meta.xml

API Name: Update_Dues_Paid_Thru_Date_on_the_Account Status: Active Type: Custom Trigger: After Subscription create/update when Status = Active (asynchronous)

Business Purpose

Automatically updates the Member's Dues Paid Through date (Membership_End_Date__c) on their Account when a subscription becomes active and has a later end date than the current membership, ensuring members have accurate expiration information.

Process Flow

  1. Triggers after Subscription create/update when Status__c = "Active"
  2. Runs asynchronously (AsyncAfterCommit) to avoid governor limits
  3. Retrieves the Account related to the Subscription
  4. Validates Account was found
  5. Gets the related Subscription from Account's AANP_Membership__c lookup
  6. Compares current Subscription with Account's membership Subscription:
  7. Product must match
  8. Account must match
  9. Status must be Active
  10. New End Date must be GREATER than existing End Date
  11. If all conditions met:
  12. Sets Account.Membership_End_Date__c = Subscription.End_Date__c
  13. Updates the Account record
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: Subscription Create/Update<br/>After Save - Async]) --> GetAccount[Get Account:<br/>Lookup Account by Subscription.Account__c<br/>Include AANP_Membership__r.Subcription__c]

    GetAccount --> CheckAccount{Account Found?}
    CheckAccount -->|No| End([End])
    CheckAccount -->|Yes| GetRelatedSub[Get Related Subscription:<br/>From Account.AANP_Membership__r.Subcription__c]

    GetRelatedSub --> CheckRelated{Related<br/>Subscription<br/>Found?}
    CheckRelated -->|No| End
    CheckRelated -->|Yes| Validate{Validate Update Criteria:<br/>• Same Product?<br/>• Same Account?<br/>• Status = Active?<br/>• New End Date > Old End Date?}

    Validate -->|All True| UpdateAccount[Update Account:<br/>Membership_End_Date__c =<br/>New Subscription End_Date__c]
    Validate -->|No| End

    UpdateAccount --> End

    style Start fill:#e1f5ff
    style GetAccount fill:#f0e1ff
    style GetRelatedSub fill:#f0e1ff
    style CheckAccount fill:#fff4e1
    style CheckRelated fill:#fff4e1
    style Validate fill:#fff4e1
    style UpdateAccount fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes Active subscriptions
  • Only updates if new End Date is later than current one (prevents backdating)
  • Requires exact match on Product and Account between subscriptions
  • Uses Account's AANP_Membership__c to identify which subscription is "active"
  • Runs asynchronously to prevent blocking user transactions
  • Requires record to change to meet criteria (not every Active subscription update)

Dependencies

  • Objects: Subscription__c, Account, Membership__c
  • Fields:
  • Subscription: Status__c, End_Date__c, Product__c, Account__c
  • Account: Membership_End_Date__c, AANP_Membership__c
  • Membership: Subcription__c (lookup to Subscription)
  • Relationships: Account → AANP_Membership__c → Subscription__c

Changes

No Pull Request references found in metadata.

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • Complex Relationship Chain: Flow traverses Account → Membership → Subscription which could fail at any step
  • Missing Null Checks: Doesn't verify AANP_Membership__c or its Subscription__c lookup exist
  • No Error Handling: Async execution means errors won't be visible to users

HIGH - Address Soon After Go-Live

  • Naming Confusion: Field is called "Membership_End_Date__c" but is updated from Subscription - verify this is correct mapping
  • One-Way Update: Only extends end date forward, never shortens it - could leave stale future dates
  • No Notification: Users don't receive confirmation when their membership end date is updated

MEDIUM - Future Enhancement

  • Error Logging: Add error handling to log failures to Custom Object for admin review
  • Audit Trail: Track when and why Membership_End_Date__c changes
  • Handle Backdating: Consider logic for when End Date needs to be shortened (cancelled subscriptions)
  • Multiple Products: Verify behavior when Account has multiple active subscriptions

LOW - Monitor

  • Async Execution: Monitor job queue for failures or backlogs
  • Data Accuracy: Periodically verify Membership_End_Date__c matches latest active Subscription End_Date__c
  • Edge Cases: Watch for subscriptions that activate then immediately cancel

Maintenance Notes

Complexity: Medium - Complex relationship traversal with multiple validation checks Review Schedule: Quarterly review when subscription or membership logic changes Async Pattern: AsyncAfterCommit prevents governor limits but hides errors - monitor job logs Critical Business Data: Membership End Date drives access and renewal communications Relationship Dependencies: Tightly coupled to Subscription, Membership, and Account data models