Skip to content

Flow Name: Related Orders: Refunds and Cancellations

Last Updated: 2025-10-15 Source Code: Related_Orders_Refunds_and_Cancellations.flow-meta.xml

API Name: Related_Orders_Refunds_and_Cancellations Status: Active Type: Screen Flow Trigger: Manual invocation with recordId input parameter

Business Purpose

Provides a comprehensive view of cancelled and refunded orders related to a source order. Enables users to see the complete order lifecycle including cancellations and returns through an interactive screen interface.

Process Flow

  1. Order Summary Lookup: Finds OrderSummary record for the input recordId
  2. Order Item Summary Query: Gets OrderItemSummary records with CANCELED or RETURNED status
  3. Collection Processing: Iterates through order item summaries to categorize:
  4. CANCELED items → Add to cancelled order IDs collection
  5. RETURNED items → Add to returned order IDs collection
  6. Related Order Queries:
  7. Finds Order records with RelatedOrderId matching cancelled order IDs
  8. Finds Order records with RelatedOrderId matching returned order IDs
  9. Display Screen: Shows two data tables:
  10. Cancelled Orders table with order details
  11. Refunded Orders table with order details
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: Manual invocation with recordId input parameter]) --> Screen[Display Screen:<br/>User Input Required]

    Screen --> UserInput[User Enters Data]
    UserInput --> Process[Process Input]
    Process --> Action[Execute Action]
    Action --> End([End])

    style Start fill:#e1f5ff
    style Screen fill:#fff4e1
    style UserInput fill:#e1ffe1
    style Process fill:#ffe1e1
    style Action fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Input recordId must correspond to an existing order with OrderSummary
  • Only displays orders with CANCELED or RETURNED status
  • Groups related orders by cancellation vs return status
  • Screen flow allows user interaction and navigation
  • Data tables show Order Number, Status, Order Start Date, and Order Amount

Dependencies

  • Order object with RelatedOrderId field and custom Order_Link__c field
  • OrderSummary object with OriginalOrderId field
  • OrderItemSummary object with Status and OrderSummaryId fields
  • Screen flow components (datatable extension)

Changes

No specific PR references found in flow description

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • Custom Field Dependency: Order.Order_Link__c field must exist for table display

HIGH - Address Soon After Go-Live

  • Performance with Large Datasets: No limits on order item summary queries
  • Screen Timeout: Long processing time could cause screen timeout
  • Empty Results Handling: Limited user feedback when no related orders exist

MEDIUM - Future Enhancement

  • Add pagination for large result sets
  • Implement error handling for missing order summaries
  • Add summary statistics (total refund amounts, count of orders)
  • Consider adding filtering options by date range or amount

LOW - Monitor

  • User experience with large order hierarchies
  • Screen performance with complex order relationships
  • Usage patterns to determine if additional fields needed in tables

Maintenance Notes

Screen flow with complex order relationship navigation. Monitor performance with large datasets and consider implementing result limits or pagination. Ensure custom fields used in data tables remain accessible to users. Flow type indicates manual invocation from order record pages.