Skip to content

Flow Name: [I2C] Order Product: Auto-Renew update

Last Updated: 2025-05-01 Source Code: I2C_Order_Product_Auto_Renew_update.flow-meta.xml

API Name: I2C_Order_Product_Auto_Renew_update Status: Active Type: Custom Trigger: OrderItem update (after save) when Chargent_Recurring_Order__c becomes null

Business Purpose

Manages subscription auto-renewal status when OrderItems are dissociated from recurring ChargentOrders, ensuring subscription records reflect that they are no longer part of automated renewal cycles.

Process Flow

  1. Dissociation Detection: Triggers when OrderItem's Chargent_Recurring_Order__c field is cleared (becomes null)
  2. Auto-Renew Deactivation: Sets Auto_Renew__c = false on related subscription records
  3. Charge Recalculation: Calls Apex action to recalculate recurring charges on the previous ChargentOrder
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: OrderItem update (after save) when Chargent_Recurring_Order__c becomes null]) --> Lookup[Lookup Related Data]

    Lookup --> Found{Data<br/>Found?}
    Found -->|No| End([End])
    Found -->|Yes| Calculate[Calculate/Determine Values]

    Calculate --> Update[Update Records]
    Update --> End

    style Start fill:#e1f5ff
    style Lookup fill:#f0e1ff
    style Found fill:#fff4e1
    style Calculate fill:#e1ffe1
    style Update fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes when Chargent_Recurring_Order__c field changes to null
  • Requires record to have changed to meet criteria (prevents unnecessary processing)
  • Updates related subscription records to disable auto-renewal
  • Recalculates charges on the ChargentOrder that lost the OrderItem
  • Typically occurs during renewal processing when new OrderItems replace old ones

Dependencies

  • OrderItem with Chargent_Recurring_Order__c lookup field
  • Subscriptions__r relationship from OrderItem to subscription records
  • Subscription object with Auto_Renew__c field
  • Apex class: I2C_RecalculateRecurringCharge
  • ChargentOrder for charge recalculation

Changes

Flow description indicates this handles OrderItem removal from recurring Chargent orders and unchecks auto-renewal.

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • No error handling for subscription update failures
  • No validation that Apex action succeeds
  • Missing null checks for related subscription records

HIGH - Address Soon After Go-Live

  • No error handling for Apex action failures
  • Could leave subscriptions in inconsistent state if updates fail
  • Missing logging for auto-renewal status changes

MEDIUM - Future Enhancement

  • Add comprehensive error handling for all update operations
  • Implement proper logging and audit trail
  • Add validation that subscription updates are successful
  • Consider adding rollback mechanism for failed operations

LOW - Monitor

  • Monitor for failed subscription auto-renewal updates
  • Track Apex action success rates for charge recalculation
  • Validate that subscription statuses remain consistent

Maintenance Notes

Important flow for subscription lifecycle management. Handles the cleanup when OrderItems are removed from recurring billing. Critical for maintaining data integrity in auto-renewal systems. Consider adding robust error handling before production deployment.