Flow Name: Daily Product Check¶
Last Updated: 2024-08-26 Source Code: Daily_Product_Check.flow-meta.xml
API Name: Daily_Product_Check Status: Active Type: Custom Trigger: Scheduled daily at midnight (Scheduled flow)
Business Purpose¶
This automated flow manages product availability by daily evaluating products against their availability windows (DateAvailable__c and AvailableUntil__c) and updating their active status and visibility flags accordingly. It ensures that products are automatically activated when their availability period begins and deactivated when it ends.
Process Flow¶
- Deactivation Process:
- Query products where AvailableUntil__c ≤ TODAY() and IsActive = true
- Set IsActive = false, IsAvailableOnline__c = false, IsVisibleInProductCatalog__c = false
- Add to update collection
- Activation Process:
- Query products where at least one status flag is false AND DateAvailable__c ≤ TODAY() AND AvailableUntil__c > TODAY()
- Set IsActive = true, IsAvailableOnline__c = true, IsVisibleInProductCatalog__c = true
- Add to update collection
- Bulk Update: Perform single bulk update of all modified products
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: Scheduled daily at midnight (Scheduled flow)]) --> 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¶
- Deactivation Criteria: Products are deactivated when AvailableUntil__c date has passed (≤ TODAY())
- Activation Criteria: Products are activated when DateAvailable__c ≤ TODAY() AND AvailableUntil__c > TODAY()
- Status Consistency: All three flags (IsActive, IsAvailableOnline__c, IsVisibleInProductCatalog__c) are updated together
- Scheduled Execution: Runs daily at midnight to ensure availability changes take effect at start of business day
- Bulk Processing: Uses efficient bulk update pattern to minimize DML operations
Dependencies¶
- Product2 standard object with custom fields: DateAvailable__c, AvailableUntil__c, IsAvailableOnline__c, IsVisibleInProductCatalog__c
- E-commerce catalog systems that depend on product visibility flags
- Order processing systems that check product availability
- Scheduled flow execution capability (requires automation user licenses)
⚠️ Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Date Logic Verification: Ensure DateAvailable__c and AvailableUntil__c are populated correctly on all products
- Timezone Considerations: Scheduled at midnight UTC - verify this aligns with business timezone requirements
HIGH - Address Soon After Go-Live¶
- Monitoring: No error notification if scheduled execution fails or products don't update as expected
- Bulk Limits: No governor limit protection for large numbers of products
MEDIUM - Future Enhancement¶
- Execution Logging: Add audit trail of which products were activated/deactivated each day
- Error Handling: Implement retry logic and notification for failed updates
LOW - Monitor¶
- Performance: Monitor execution time as product catalog grows
- Data Quality: Verify DateAvailable__c and AvailableUntil__c fields are maintained properly
Maintenance Notes¶
Complexity: Low - Straightforward scheduled automation with clear date-based business logic. Review monthly to monitor execution success and quarterly to verify date field usage patterns. Consider performance optimization if product catalog grows significantly. Test timezone behavior during daylight saving transitions.