Flow Name: Order 24 hours after pending payment¶
Last Updated: 2025-10-20 Source Code: Order_24_hours_after_pending_payment.flow-meta.xml
API Name: Order_24_hours_after_pending_payment Status: Active Type: Custom Trigger: Time-based: 24 hours after Pending_Payment_Date__c when Order status is Pending Payment
Business Purpose¶
Automatically reverts manual orders containing PAC (presumably Payment Acceptance Code) products from "Pending Payment" status back to "Draft" if payment is not received within 24 hours, preventing orders from remaining in pending state indefinitely.
Process Flow¶
- Scheduled path triggers 24 hours after Pending_Payment_Date__c is set
- Requires:
- Status = "Pending Payment"
- Pending_Payment_Date__c is not null
- Manual_Order__c = true
- Record changed to meet criteria (not just any update)
- Retrieves the Order record to verify current state
- Checks conditions:
- Status still "Pending Payment"
- Deadline passed formula: now() > Pending_Payment_Date__c + 1 day
- Pending_Payment_Date__c not null
- Includes_PAC_Products__c = true
- If all conditions met, updates Status to "Draft"
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: Order Update<br/>Status = Pending Payment<br/>Pending_Payment_Date__c Not Null<br/>Manual_Order__c = true]) --> Wait[Wait 24 Hours After<br/>Pending_Payment_Date__c]
Wait --> GetOrder[Get Order:<br/>Refresh order data]
GetOrder --> CheckStatus{Validate:<br/>• Status still 'Pending Payment'?<br/>• 24 hours passed?<br/>• Pending_Payment_Date__c not null?<br/>• Includes_PAC_Products__c = true?}
CheckStatus -->|All True| UpdateStatus[Update Order:<br/>Status = 'Draft']
CheckStatus -->|No| End([End])
UpdateStatus --> End
style Start fill:#e1f5ff
style Wait fill:#fff4e1
style GetOrder fill:#f0e1ff
style CheckStatus fill:#fff4e1
style UpdateStatus fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- Only processes manual orders (Manual_Order__c = true)
- 24-hour deadline from Pending_Payment_Date__c
- Only affects orders with PAC products (Includes_PAC_Products__c = true)
- Uses formula: now() > Pending_Payment_Date__c + 1
- Rechecks status before updating to prevent race conditions
- Filter on update ensures only newly pending orders trigger scheduled path
Dependencies¶
- Objects: Order (standard with custom fields)
- Fields:
- Status (standard)
- Pending_Payment_Date__c
- Manual_Order__c
- Includes_PAC_Products__c
- Related Flows: Order_before_update (sets Includes_PAC_Products__c and Pending_Payment_Date__c)
Changes¶
No Pull Request references found in metadata.
⚠️ Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- No Notification: Users/customers are not notified when order reverts to Draft
- Lost Work: Any payment processing in progress will be lost when order reverts to Draft
- Unclear PAC Definition: "PAC Products" is not documented - verify business rule accuracy
HIGH - Address Soon After Go-Live¶
- Hardcoded Timeout: 24-hour window is hardcoded - should be configurable per product or order type
- No Retry Logic: Orders revert to Draft with no automatic retry or follow-up
- Status Validation: Doesn't verify Draft is a valid status transition from Pending Payment
MEDIUM - Future Enhancement¶
- Email Notifications: Send reminder email at 23 hours, confirmation email when reverted
- Configurable Timeouts: Use Custom Metadata to define timeout periods by product/order type
- Grace Period: Consider warning period before automatic reversion
- Audit Trail: Log reason for status change (auto-reverted after 24 hours)
LOW - Monitor¶
- Scheduled Execution: Monitor that scheduled paths are executing on time
- Edge Cases: Watch for orders that revert incorrectly (payment was being processed)
- Manual_Order__c Accuracy: Verify field is set correctly for all manual orders
Maintenance Notes¶
Complexity: Medium - Time-based trigger with conditional revalidation Review Schedule: Quarterly review of timeout period appropriateness Business Impact: Critical for order processing workflow - changes affect revenue Scheduled Triggers: Monitor execution logs to ensure scheduled paths are running Paired Flow: Works in conjunction with Order_before_update flow - test both together