Skip to content

Flow Name: Subscription Renewal Scheduled Flow

Last Updated: 2025-10-22 Source Code: Subscription_Renewal_Scheduled_Flow.flow-meta.xml

API Name: Subscription_Renewal_Scheduled_Flow Status: Active Type: Custom Trigger: Scheduled daily at 12:00 AM

Business Purpose

Automates subscription renewal lifecycle by identifying subscriptions expiring in 30 days, creating renewal orders with auto-renewal discounts, and maintaining relationships between original and renewal subscriptions for revenue continuity.

Process Flow

  1. Daily at midnight, queries subscriptions expiring in exactly 30 days (Active, Auto_Renew = true, no existing renewal order)
  2. For each subscription: Creates renewal Order in Draft status, copies fields from original order
  3. For each subscription: Creates OrderItems with pricing (applies auto-renewal discount if eligible)
  4. Updates all renewal orders to "Ready for Activation" status
  5. Updates original subscriptions with Renewing_order__c reference
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: Daily at Midnight]) --> Query[Query Subscriptions<br/>Expiring in 30 Days]
    Query --> Loop1[Loop: Create Renewal Orders]
    Loop1 --> Loop2[Loop: Create Order Products]
    Loop2 --> Pricing{Auto-Renewal<br/>Discount?}
    Pricing -->|Yes| DiscountPrice[Apply Discount Pricing]
    Pricing -->|No| RegularPrice[Use Regular Pricing]
    DiscountPrice --> Activate[Activate Renewal Orders]
    RegularPrice --> Activate
    Activate --> UpdateSubs[Update Original Subscriptions]
    UpdateSubs --> End([End])

    style Start fill:#e1f5ff
    style Query fill:#e1ffe1
    style Loop1 fill:#fff4e1
    style Loop2 fill:#fff4e1
    style Pricing fill:#fff4e1
    style DiscountPrice fill:#ffe1e1
    style RegularPrice fill:#ffe1e1
    style Activate fill:#ffe1e1
    style UpdateSubs fill:#e1ffe1
    style End fill:#e1f5ff

Key Business Rules

  • Processes subscriptions expiring exactly 30 days from execution date
  • Only processes Active subscriptions with Auto_Renew__c = true
  • Applies auto-renewal discount when Account.Auto_Renew__c = true AND Product.Auto_Renewal_Discount_Percent__c exists
  • Creates orders in Draft, then changes to "Ready for Activation" to trigger OrderSummary
  • Updates original subscription with Renewing_order__c lookup

Dependencies

  • Subscription__c object with Auto_Renew__c, Status__c, End_Date__c, Renewing_order__c fields
  • Order object with renewal-specific fields
  • OrderItem and PriceBookEntry objects
  • Product2 with Auto_Renewal_Discount_Percent__c
  • Account with Auto_Renew__c
  • OrderSummary creation automation

Changes

No Pull Request references found in metadata.

Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • Fixed 30-day window should be configurable via Custom Metadata
  • Monitor daily execution performance with large subscription volumes

HIGH - Address Soon After Go-Live

  • Add error handling and notifications for failed renewals
  • Verify auto-renewal discount formula matches business requirements

MEDIUM - Future Enhancement

  • Make 30-day lead time configurable
  • Add retry mechanism for failed renewals
  • Implement batch processing for very large subscription volumes

LOW - Monitor

  • Track renewal order creation success rates
  • Monitor auto-renewal discount application accuracy

Maintenance Notes

Complexity: High - Scheduled execution, complex pricing logic, multiple object creation Review Schedule: Monthly review during renewal periods, semi-annual full review Performance: Daily execution - monitor with subscription growth Testing: Requires extensive testing with various subscription and pricing scenarios