Flow Name: Order Summary Fulfillment¶
Last Updated: 2025-09-23 Source Code: Order_Summary_Fulfillment.flow-meta.xml
API Name: Order_Summary_Fulfillment Status: Active Type: Custom Trigger: OrderSummary record changes (AsyncAfterCommit) with specific status and order type combinations
Business Purpose¶
Automates the complete fulfillment process for OrderSummary records including creating fulfillment orders, generating invoices, processing payments, and updating status tracking. This flow handles both regular e-commerce orders and manual/renewal orders with different processing paths.
Process Flow¶
- Fulfillment Check: Determines if OrderSummary needs fulfillment by checking for existing FulfillmentOrder
- Location Assignment: Looks up virtual location "d2c-web_store" for fulfillment
- Order Item Processing:
- Sets default Type to "Order Product" for items missing this value
- Loops through OrderItemSummaries to build fulfillment groups
- Fulfillment Order Creation: Creates fulfillment orders with email delivery type
- Invoice Generation: Creates invoices from fulfillment orders
- Payment Processing: Initiates ensure funds process for payment capture
- Status Updates: Updates FulfillmentOrder to "Fulfilled", sets Order fulfillment date, and marks OrderSummary as "Fulfilled"
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: OrderSummary record changes (AsyncAfterCommit) with specific status and order type combinations]) --> Check{Entry Criteria<br/>Met?}
Check -->|No| End([End])
Check -->|Yes| Process[Execute Business Logic]
Process --> Update[Update Records]
Update --> End
style Start fill:#e1f5ff
style Check fill:#fff4e1
style Process fill:#e1ffe1
style Update fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- Trigger Conditions: Processes three scenarios:
- Regular orders: Status = 'Created', Manual_Order = false, Renewal_Order = false
- Paid manual orders: Status = 'Paid', Manual_Order = true, Renewal_Order = false
- Paid renewal orders: Status = 'Paid', Renewal_Order = true
- Fulfillment Type: All orders use "Email" fulfillment
- Location: Uses virtual location "d2c-web_store" (hardcoded)
- Fulfillment Date Logic:
- Non-manual/non-renewal orders: Current DateTime
- Manual/renewal orders: Uses Order.Fulfillment_Date__c or NOW() if blank
Dependencies¶
- OrderSummary, FulfillmentOrder, OrderItemSummary, OrderDeliveryGroupSummary objects
- Virtual Location named "d2c-web_store" with LocationType = 'Virtual'
- Order object with Manual_Order__c, Renewal_Order__c, Fulfillment_Date__c fields
- ConnectApi fulfillment actions (createFulfillmentOrder, createInvoiceFromFulfillmentOrder, ensureFundsOrderSummaryAsync)
Changes¶
[PR-33944] - Fix for stores not referencing a location
⚠️ Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Hardcoded Location Dependency: Flow requires exact virtual location named "d2c-web_store" - if location is renamed or deleted, all fulfillments fail
- Missing Error Handling: No fault paths for ConnectApi actions - if invoice creation or payment processing fails, flow stops without cleanup
- Infinite Loop Risk: No safeguards prevent the same OrderSummary from triggering multiple fulfillment attempts
HIGH - Address Soon After Go-Live¶
- Performance Bottleneck: Sequential processing of multiple API calls could cause timeouts during peak order periods
- Order Item Type Assumption: Automatically assigns "Order Product" type without validation - may cause issues for subscriptions or services
- Payment Processing: EnsureFunds action runs without validating payment method availability
MEDIUM - Future Enhancement¶
- Audit Trail: Limited logging of fulfillment steps for troubleshooting
- Fulfillment Date Logic: Complex formula could be simplified or made configurable
- Location Flexibility: Should support multiple fulfillment locations based on order characteristics
LOW - Monitor¶
- Variable Naming: Some inconsistent naming (fulfilmentGroups vs fulfillmentGroups)
- API Version: Uses older API version 61.0, consider updating for newer features
Maintenance Notes¶
Complexity: High - This is a critical business process with multiple API integrations and complex state management. Any changes require thorough testing in sandbox with full order lifecycle. The hardcoded location dependency makes this flow extremely sensitive to configuration changes. Recommended monthly review of fulfillment metrics and quarterly testing of all fulfillment scenarios.