New to Kestra?
Use blueprints to kickstart your first workflows.
Run Kestra flows on specific days of the week using a Schedule trigger `when` expression. Automate weekday or weekend-restricted workflows with precise scheduling control.
id: schedule-condition-dayweek
namespace: company.team
triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 11 * * *"
when: "{{ dayOfWeek(trigger.date) == 'MONDAY' }}"
tasks:
- id: hello
type: io.kestra.plugin.core.log.Log
message: Demo for DayWeek condition
Run a Kestra flow on a recurring cron schedule, then gate each execution so it only proceeds on a specific weekday. This blueprint pairs the io.kestra.plugin.core.trigger.Schedule trigger with a when Pebble expression to fire at 11am every day, while only allowing the run to continue when the trigger date is a Monday. It solves the common scheduling problem where a single cron expression cannot express calendar-aware rules like "run only on Mondays" without brittle workarounds, giving you precise, declarative control over which days a workflow actually executes.
schedule trigger of type io.kestra.plugin.core.trigger.Schedule evaluates the cron expression 0 11 * * *, which marks every day at 11am as a candidate execution time.when expression, {{ dayOfWeek(trigger.date) == 'MONDAY' }}, which compares the trigger date's day of week against MONDAY.hello task of type io.kestra.plugin.core.log.Log writes a demo message confirming the when expression matched.A raw cron scheduler can express "every day at 11am" but cannot cleanly say "only when that day is a Monday" without encoding it into the cron string itself, which quickly becomes unreadable for multi-weekday or exclusion rules. Kestra separates the schedule from the calendar rule, so the cadence and the day-of-week check each stay legible. On top of that you get event-driven triggers, automatic retries, full execution lineage, and a declarative YAML definition that lives in version control. The trigger's when expression fills the gap a tool's own scheduler leaves open: readable, composable day-of-week logic layered on a standard cron schedule using the dayOfWeek() Pebble function.
This blueprint references no secrets.
schedule trigger evaluates daily at 11am.hello task logs its message.dayOfWeek to any weekday, for example FRIDAY, to shift the allowed day.when expression with or to allow a set of weekdays, for example {{ dayOfWeek(trigger.date) == 'MONDAY' or dayOfWeek(trigger.date) == 'FRIDAY' }}.hello Log task with real work such as a data load, API call, or notification.