Overview
Encore OS’s report scheduling system automates report generation and delivery. Schedule reports to run daily, weekly, monthly, or on custom schedules, with automatic email delivery to recipients.Features
Schedule Types
- Daily: Run at specified time every day
- Weekly: Run on specific day of week
- Monthly: Run on specific day of month
- Custom: Define custom cron expression
Output Formats
- PDF: Professional formatted reports (requires additional library)
- CSV: Spreadsheet-compatible data export
- Excel: Native .xlsx format (requires additional library)
Delivery Options
- Email to multiple recipients
- Include summary section
- Timezone-aware scheduling
- Retry on failure
Usage
Creating a Schedule
Schedule Management Page
Schedule Form Component
Schedule Configuration
Time Settings
- Run Time: 24-hour format (HH:MM:SS)
- Timezone: IANA timezone identifier
- Next Run: Automatically calculated by trigger
Recipients
Add multiple recipients with:- Email address (required)
- Display name (optional)
State Tracking
System automatically tracks:next_run_at- Next execution timelast_run_at- Last execution timelast_run_status- success | partial | failedlast_run_error- Error message if failedrun_count- Total executions
Cron Expressions
Presets
- Daily at 8am:
0 8 * * * - Weekly Monday 8am:
0 8 * * 1 - Monthly 1st 8am:
0 8 1 * * - Monthly 15th 8am:
0 8 15 * *
Custom Cron Format
- Every weekday 9am:
0 9 * * 1-5 - Every 6 hours:
0 */6 * * * - Last day of month:
0 8 L * *(custom schedule type)
Execution Flow
Automated Execution
- Edge function runs every 15 minutes
- Queries schedules where
next_run_at <= now() - Executes report SQL with parameters
- Generates output in requested format
- Sends email to all recipients
- Updates schedule status and calculates next run
Manual Execution
Trigger immediate execution:Error Handling
Retry Logic
- Failed executions: Automatic retry (3 attempts)
- Exponential backoff: 5min, 15min, 1hr
- Permanent failure after 3 attempts
- Error message logged in
last_run_error
Failure Notifications
When a report fails to generate, the first recipient automatically receives a branded failure notification email with:- Error message and details (sanitized to prevent sensitive information exposure)
- Troubleshooting suggestions
- Link to reports page
Recovery
Failed schedules:- Review error in
last_run_error - Fix underlying issue (report SQL, permissions)
- Enable schedule again
- Next run calculated automatically
Email Delivery
Branded Email Templates
Scheduled reports use professional HTML email templates featuring:- Branded Encore OS header with gradient
- Report details card with name and description
- Statistics row (generated date, row count, format, file size)
- Prominent download button with 7-day signed URL
- Next scheduled run indicator
- Mobile-responsive design
Email Template Localization
Email templates support multiple languages:- Templates use translation keys via
localeparameter - Default: English (
en) - Infrastructure ready for Spanish (
es), French (fr), and more - Per-organization locale settings planned for future releases
Customizing Email Content
Theinclude_summary flag adds a columns preview to the email:
Pre-Rendered HTML Support
For advanced customization, the email system supports pre-rendered HTML:Best Practices
Performance
- Limit report data (use date ranges)
- Add indexes on frequently queried columns
- Test report SQL independently first
- Monitor execution time in logs
Scheduling
- Avoid peak hours for heavy reports
- Stagger multiple reports (avoid all at same time)
- Consider timezone of recipients
- Use off-hours for resource-intensive reports
Recipients
- Use distribution lists for large teams
- Keep recipient list under 50 people
- Include only stakeholders who need the report
- Update email addresses regularly
Output Format
- CSV: Best for data analysis (Excel, Google Sheets)
- PDF: Best for presentations and archived records
- Excel: Best for formatted spreadsheets with formulas
Monitoring
Schedule Health
Check schedule status:enabled = trueandnext_run_atpopulatedlast_run_status = 'success'- No recent
last_run_error run_countincrementing
Edge Function Logs
Monitor execution:- Schedules processed
- Execution errors
- Email delivery failures
Delivery Confirmation
Recipients should confirm receipt of:- First scheduled report
- Changed reports (after modifications)
- Critical financial reports
Troubleshooting
Schedule Not Running
- Check
enabled = true - Verify
next_run_atis in the past - Review edge function logs
- Confirm organization has access to report
Report Fails to Generate
- Test report SQL independently
- Check report parameters are valid
- Verify user has permissions
- Review RLS policies on data tables
Email Not Delivered
- Check recipient email addresses
- Verify Entra/Gmail provider configuration and required secrets
- Review email delivery logs
- Check spam folders
- Confirm sender identity/domain is properly configured in the selected provider
Incorrect Schedule Time
- Verify timezone setting
- Check cron expression format
- Ensure run_time is valid (HH:MM:SS)
- Review calculated next_run_at
Advanced Features
Conditional Scheduling
Schedule based on data conditions:Parameterized Reports
Pass dynamic parameters:Multi-Format Delivery
Create multiple schedules for same report:- PDF to executives
- CSV to analysts
- Excel to department heads