Scheduled Reports
Run automations on a schedule using the Schedule trigger with CONNECTOR, DATABASE, and FUNCTION steps.
Time
Level
Prerequisites
20 minutes
Beginner
Basic Flow knowledge
What You'll Build
An automation that:
- Runs every morning at 9 AM (Schedule trigger)
- Fetches data using CONNECTOR or DATABASE step
- Formats a report using FUNCTION step
- Sends via email using CONNECTOR step
Step 1: Create the Automation
- Go to Automations
- Click + New Automation
- Name:
Daily Sales Report - Click Create
Step 2: Add Schedule Trigger
Configure Trigger
- Click Add Trigger
- Select Schedule
- Configure the schedule:
Cron Expression (Advanced)
For complex schedules, use cron syntax:
Step 3: Fetch Report Data
You have two options: use CONNECTOR for APIs or DATABASE for direct SQL.
Option A: CONNECTOR Step (API)
- Click + below the trigger
- Select CONNECTOR from the step palette
- Configure:
Option B: DATABASE Step (SQL)
- Click + below the trigger
- Select DATABASE from the step palette
- Configure:
SQL Query
SELECT
DATE(created_at) as date,
COUNT(*) as total_orders,
SUM(total) as total_revenue,
json_agg(json_build_object('name', product_name, 'units', quantity)
ORDER BY quantity DESC LIMIT 5) as top_products
FROM orders
WHERE DATE(created_at) = CURRENT_DATE - INTERVAL '1 day'
GROUP BY DATE(created_at)
Step 4: Format the Report
Add FUNCTION Step
- Click + after the data fetch step
- Select FUNCTION from the step palette
- Name:
formatReport
Write the Formatting Code
// Get data from previous step
const data = context.step.fetchData.output;
// Build HTML report
const report = `
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Arial, sans-serif; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background: #4CAF50; color: white; }
.summary { margin: 20px 0; }
</style>
</head>
<body>
<h1>Daily Sales Report</h1>
<p><strong>Date:</strong> ${data.date}</p>
<div class="summary">
<h2>Summary</h2>
<ul>
<li>Total Orders: ${data.total_orders}</li>
<li>Total Revenue: $${data.total_revenue.toFixed(2)}</li>
</ul>
</div>
<h2>Top Products</h2>
<table>
<tr><th>Product</th><th>Units</th></tr>
${data.top_products.map(p =>
`<tr><td>${p.name}</td><td>${p.units}</td></tr>`
).join('')}
</table>
</body>
</html>
`;
return { html: report, subject: `Daily Sales Report - ${data.date}` };
Step 5: Send the Report
Add CONNECTOR Step for Email
- Click + after the FUNCTION step
- Select CONNECTOR from the step palette
- Choose your email connector (SendGrid, SES, etc.)
Configure Email Parameters
Step 6: Add Error Handling
Use CONDITION for Error Check
After the data fetch step, add a CONDITION:
{{ steps.fetchData.output != null }}
True Branch (Success)
Continue with formatting and sending.
False Branch (Error)
Add a CONNECTOR step to send error notification:
Subject: ⚠️ Daily Report Failed
Body: The daily sales report could not be generated.
Please check the data source.
Complete Workflow
┌─────────────────────┐
│ Schedule Trigger │
│ Daily 9:00 AM │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ DATABASE │
│ Fetch sales data │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ CONDITION │
│ Data exists? │
├──────────┬──────────┤
│ True │ False │
└────┬─────┴────┬─────┘
│ │
▼ ▼
┌────────┐ ┌────────┐
│FUNCTION│ │CONNECTOR│
│Format │ │Error │
└────┬───┘ │Email │
│ └────────┘
▼
┌────────────────────┐
│ CONNECTOR │
│ Send report email │
└────────────────────┘
Step 7: Test and Activate
Manual Test
- Click Save
- Click Test
- The automation runs immediately (ignoring schedule)
- Verify the email arrives
Activate
- Toggle Active
- The automation will run on schedule
Monitoring Scheduled Jobs
View Run History
- Open your automation
- Click Runs tab
- See all scheduled executions
Check Run Details
For each run, view:
- Trigger timestamp
- Step-by-step execution
- Output from each step
- Errors (if any)
Common Schedule Patterns
Business Reports
Operational Tasks
Best Practices
Do
- Set schedules in your team's timezone
- Include dates in report subjects
- Handle missing data gracefully
- Monitor scheduled job success rates
Avoid
- Scheduling during peak hours
- Too-frequent schedules (consider events instead)
- Missing error notifications
- Large queries without limits
Next Steps
- REST API Integration → — Build API integrations
- Slack Notifications → — Post to Slack channels