Files
dify-docs/en/guides/workflow/node/schedule-trigger.mdx
Riskey 53c4c93b1e add docs for trigger (#504)
* draft

* draft

* draft

* refine dev docs

* almost

* update

* remove sys.file and sys.query; add sys.timestamp

* update the end node to output

* modify the introduction section of variable

* fix typo

* adjust image size

* remove unnecessary list

* feedback fix

* remove example

* feedback fix & add en/ja dev docs

* correct description

* fix typos

* replace UI text

* refinements & add zh-ja translation

* feedback fixes

* fix punctuation

* refine heading-reference

* typo

* adjust casing & remove sys.timestamp from chatflow

* Docs tools: 2 succeeded, some failed

Rename operation failed: - Lang 'zh': File 'dify-docs/plugin-dev-zh/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get'
- Lang 'zh': File 'dify-docs/plugin-dev-zh/0222-datasource-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'zh': File 'dify-docs/plugin-dev-zh/0222-tool-oauth.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'zh': File 'dify-docs/plugin-dev-zh/0222-trigger-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'en': File 'dify-docs/plugin-dev-en/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get'
- Lang 'en': File 'dify-docs/plugin-dev-en/0222-datasource-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'en': File 'dify-docs/plugin-dev-en/0222-tool-oauth.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'en': File 'dify-docs/plugin-dev-en/0222-trigger-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'ja': File 'dify-docs/plugin-dev-ja/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get'
- Lang 'ja': File 'dify-docs/plugin-dev-ja/0222-datasource-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).
- Lang 'ja': File 'dify-docs/plugin-dev-ja/0222-trigger-plugin.mdx' - Skipped (non-compliant):
Missing/empty critical frontmatter fields for renaming: dimensions.type.primary, dimensions.type.detail, dimensions.level, standard_title, language (expected for metadata, though not used in filename suffix anymore).

---------

Co-authored-by: Riskey <riskey47@dify.ai>
Co-authored-by: alterxyz <88554920+alterxyz@users.noreply.github.com>
2025-10-30 21:11:33 +08:00

115 lines
5.2 KiB
Plaintext

---
title: Schedule Trigger
---
## Introduction
<Info>
Triggers are available for workflow applications only.
</Info>
Schedule triggers enable your workflow to run at specified times or intervals. They are ideal for recurring tasks like generating daily reports or sending scheduled notifications.
## Add a Schedule Trigger
On the workflow canvas, right-click and select **Add Node** > **Start** > **Schedule Trigger**.
<Tip>
- A workflow can have multiple schedule triggers running in parallel. When the parallel branches contain identical consecutive nodes, you can add a [Variable Aggregator](/en/guides/workflow/node/variable-aggregator) node to merge the branches before the common section, without duplicating the same nodes across each branch.
</Tip>
## Configure a Schedule Trigger
You can configure the schedule using either the default visual picker or a cron expression.
After configuration, you can see the next 5 scheduled execution times.
<Info>
Schedule triggers do not produce output variables, but they update the system variable `sys.timestamp` (the start time of each workflow execution) each time they initiate the workflow.
</Info>
### With the Visual Picker
Use this for simple hourly, daily, weekly, or monthly schedules. For weekly and monthly frequencies, you can select multiple days or dates.
### With a Cron Expression
Use this for more complex and precise timing patterns, such as every 15 minutes from 9 AM to 5 PM on weekdays.
<Tip>
You can use LLMs to generate cron expressions.
</Tip>
#### Standard Format
A cron expression is a string that defines the schedule for executing your workflow. It consists of five fields separated by spaces, each representing a different time unit.
<Note>
Ensure that there is a single space between each field.
</Note>
```
* * * * *
| | | | |
| | | | |── Day of week (0-7 or SUN-SAT, where both 0 and 7 = Sunday)
| | | |──── Month (1-12 or JAN-DEC)
| | |────── Day of month (1-31)
| |──────── Hour (0-23)
|────────── Minute (0-59)
```
<Info>
When both the **day-of-month** and **day-of-week** fields are specified, the trigger activates on dates that match *either* field.
For example, `1 2 3 4 4` will trigger your workflow on the 3rd of April *and* every Thursday in April, not just on Thursdays that fall on the 3rd.
</Info>
#### Special Characters
| Character | Description | Example |
|:-----------|:-------------|:---------|
| `*` | Means "every". | `*` in the **hour** field means "every hour". |
| `,` | Separates multiple values. | `1,3,5` in the **day-of-week** field means "Monday, Wednesday, and Friday". |
| `-` | Defines a range of values. | `9-17` in the **hour** field means "from 9 AM to 5 PM". |
| `/` | Specifies step values. | `*/15` in the **minute** field means "every 15 minutes". |
| `L` | Means "the last". <br /><br />In the **day-of-month** field, means "the last day of the month".<br /><br />In the **day-of-week** field:<ul><li>When used alone, means "the last day of the week".</li><li>When combined with a number, means "the last occurrence of that weekday in the month". </li></ul>| `L` in the **day-of-month** field means "Jan 31, April 30, or Feb 28 in a non-leap year".<br /><br />`L` in the **day-of-week** field means Sunday.<br /><br />`5L` in the **day-of-week** field means "the last Friday of the month". |
| `?` | Means "any" or "no specific value".<br /><br />If you specify a value for the **day-of-week** field, you can use `?` for the **day-of-month** field to ignore it, and vice versa.<br /><br />Not required, because `*` works as well. | To run a task every Monday, it's more precise to set the **day-of-month** field to `?` instead of `*`. |
#### Predefined Expressions
- `@yearly`: Run once a year at 12 AM on January 1.
- `@monthly`: Run once a month at 12 AM on the first day of the month.
- `@weekly`: Run once a week at 12 AM on Sunday.
- `@daily`: Run once a day at 12 AM.
- `@hourly`: Run at the beginning of every hour.
#### Examples
| Schedule | Cron Expression |
|:----------|:-----------------|
| Weekdays at 9 AM | `0 9 * * MON-FRI` or `0 9 * * 1-5` |
| Every Wednesday at 2:30 PM | `30 14 * * WED` |
| Every Sunday at 12 AM | `0 0 * * 0` |
| Every 2 hours on Tuesday | `0 */2 * * 2` |
| The first day of every month at 12 AM | `0 0 1 * *` |
| At 12 PM on January 1 and June 1 | `0 12 1 JAN,JUN *` |
| The last day of every month at 5 PM | `0 17 L * *` |
| The last Friday of every month at 10 PM | `0 22 * * 5L` |
## Test a Schedule Trigger
When you test a schedule trigger (either via **Run this step** or by selecting it for a workflow test run), the trigger runs immediately, ignoring the configured schedule.
However, when you test a workflow with multiple triggers using **Test Run** > **Run all triggers**, the schedule trigger will wait for its next scheduled execution time instead of running instantly.
{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}
---
[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/workflow/node/schedule-trigger.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)