Flow Name: Display Related Order Promotion¶
Last Updated: 2025-10-22 Source Code: Display_Related_Order_Promotion.flow-meta.xml
API Name: Display_Related_Order_Promotion Status: Active Type: Custom Trigger: Manual/Screen Flow (invoked from Order record)
Business Purpose¶
Provides visibility into order promotions and discount line items through an interactive display. Enables users to view promotion details, discount amounts, and related pricing information for orders with multiple promotional offers.
Process Flow¶
- Retrieves Order record by ID
- Gets all OrderItems for the Order
- Loops through OrderItems to collect promotion IDs and identify discount products by SKU pattern
- Identifies discount products using specific SKU patterns (P-MEM-DISCOUNT-215, 035, 072, 037)
- Retrieves Product2 records for discount products
- Retrieves Promotion records for collected IDs
- Displays two data tables: Related Promotions and Related Discounts
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: Manual Invocation]) --> GetOrder[Get Order Record]
GetOrder --> GetItems[Get Order Items]
GetItems --> Loop[Loop Through Items]
Loop --> Collect[Collect Promotion IDs<br/>Identify Discount SKUs]
Collect --> GetProds[Get Discount Products]
GetProds --> GetPromos[Get Promotions]
GetPromos --> Display[Display Data Tables]
Display --> End([End])
style Start fill:#e1f5ff
style GetOrder fill:#e1ffe1
style GetItems fill:#e1ffe1
style Loop fill:#fff4e1
style Collect fill:#ffe1e1
style GetProds fill:#e1ffe1
style GetPromos fill:#e1ffe1
style Display fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- Identifies discount products based on hardcoded SKU patterns (P-MEM-DISCOUNT-215, 035, 072, 037)
- Displays promotion details including name, display name, target criteria, active status, and dates
- Shows discount product information with quantity and discounted amounts
- Read-only interface with non-interactive data tables
- Processes multiple promotions and discounts per order
Dependencies¶
- Order object
- OrderItem object with Promotions__c custom field
- Product2 object with StockKeepingUnit field
- Promotion object (Salesforce Commerce)
- Discount product SKU naming conventions
Changes¶
No Pull Request references found in metadata.
Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Hardcoded discount product SKUs should be moved to Custom Metadata for maintainability
HIGH - Address Soon After Go-Live¶
- Add error handling for missing Order or OrderItem records
- Consider performance impact of loop iteration for high-volume orders
MEDIUM - Future Enhancement¶
- Replace hardcoded SKU patterns with configurable Custom Metadata
- Add caching for frequently accessed discount product information
- Consider bulkifying promotion lookups
LOW - Monitor¶
- Track usage patterns to identify common discount SKU combinations
- Monitor performance with large order volumes
Maintenance Notes¶
Complexity: Medium - Multiple queries, loop processing, and SKU pattern matching Review Schedule: Review quarterly, especially when new discount products are added Hardcoded Dependencies: Four discount product SKUs require flow modification if changed Testing Requirements: Test with orders containing multiple promotions and various discount product combinations