Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/platform/workflows/configure-triggers.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/platform/workflows/configure-triggers/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Configure triggers
Note
Grafana Workflows is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.
Triggers define when a workflow starts. A workflow can have an event-based trigger, a schedule-based trigger, or run only when you start it manually. You can also combine event and schedule triggers in a single workflow.
Configure event triggers
Event triggers start a workflow when an incoming event matches a regular expression pattern.
How event matching works
Events are named according to the pattern {app}.{resource-type}.{event-type}, for example, grafana_irm_app.incident.updated. Workflows tests each matching rule against this name.
Each matching rule is a regular expression. If any rule matches the incoming event name, the workflow starts.
Add an event trigger in the editor
- Select Event as the trigger type when creating or editing a workflow.
- Select an event, for example, Incident Updated. To match a pattern instead, select Custom event and enter a regular expression in Event Name Regex.
For example, a pattern of grafana_irm_app\.incident\..* triggers the workflow on any incident event.
Add event triggers in YAML
Define matching rules in the startWhen.matchingRules section of the workflow definition:
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.incident\\.updated"You can define multiple matching rules. The workflow triggers if any rule matches:
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.incident\\.updated"
- eventNameRegex: "grafana_irm_app\\.alertgroup\\.updated"Identify available event sources
The following table lists the available event sources:
| App | Resource | Event | Example event name | Description |
|---|---|---|---|---|
grafana_irm_app | incident | updated | grafana_irm_app.incident.updated | Fires any time an incident is created or updated. |
grafana_irm_app | alertgroup | updated | grafana_irm_app.alertgroup.updated | Fires any time an alert group is created or updated. |
grafana_irm_app | schedule | updated | grafana_irm_app.schedule.updated | Fires when the current on-call users change. |
When a workflow triggers on an incident event (grafana_irm_app.incident.*), Workflows loads the
incident into the workflow context. Steps can reference it using ${resources.incident.event.title} and similar
expressions. For details, refer to Load incident data.
When a workflow triggers on an alert group event (grafana_irm_app.alertgroup.*), Workflows loads the
alert group data into the workflow context. Steps can reference it using ${resources.alertgroup.event.title} and similar
expressions. For details, refer to Load alert group data.
Configure schedule triggers
Schedule triggers start a workflow at recurring times using cron syntax. Schedules follow the standard five-field Unix cron format and default to UTC.
minute hour day-of-month month day-of-weekAdd a schedule trigger in the editor
- Select Schedule as the trigger type when creating or editing a workflow.
- In the configuration panel, set the schedule in Form mode, or select Cron and enter a cron expression in Cron Expression.
Add schedule triggers in YAML
Define schedules in the startWhen.schedules section of the workflow definition:
startWhen:
schedules:
- "0 9 * * 1-5"Run a schedule in a specific timezone
To run a schedule in a timezone other than UTC, prefix the expression with CRON_TZ=<TIMEZONE>, where TIMEZONE is an IANA timezone name.
For example, the following schedule runs at 9:00 AM Eastern time on weekdays, accounting for daylight saving time:
startWhen:
schedules:
- "CRON_TZ=America/New_York 0 9 * * 1-5"Use any IANA timezone name, for example, America/Los_Angeles, Europe/London, or Asia/Tokyo.
Expressions without a CRON_TZ= prefix run in UTC.
Understand cron syntax
Cron fields support wildcards (*), ranges (1-5), steps (*/10), and lists (1,3,5):
| Field | Range | Special characters |
|---|---|---|
| Minute | 0-59 | *, ,, -, / |
| Hour | 0-23 | *, ,, -, / |
| Day of month | 1-31 | *, ,, -, / |
| Month | 1-12 | *, ,, -, / |
| Day of week | 0-6 (0 is Sunday) | *, ,, -, / |
The following examples show common schedule patterns:
| Schedule | Meaning |
|---|---|
0 9 * * 1-5 | Every weekday at 9:00 AM UTC |
CRON_TZ=America/New_York 0 9 * * 1-5 | Every weekday at 9:00 AM Eastern time |
*/30 * * * * | Every 30 minutes |
0 0 1 * * | First day of every month at midnight UTC |
Trigger workflows manually
You can manually trigger any workflow from the editor, regardless of whether it has event or schedule triggers configured. Run is available after you save the workflow for the first time and turn on Enable. It runs the workflow as it’s shown in the editor, including unsaved changes.
To manually trigger a workflow in the editor:
- Click Run in the editor header.
- In the Trigger Workflow dialog box, edit the JSON event payload as needed and click Trigger Workflow.
Workflows expects an event in CloudEvents shape. The fields under data become available in your steps as inputs.data.*. The other fields (id, type, source, time) describe the event itself.
Note
Run doesn’t load incident or alert group data from the sample event, and it doesn’t apply trigger filters. To test a workflow that uses that data, add the incident or alert group as a resource. For details, refer to Test with incident data and Test with alert group data.
To create a workflow that runs only when manually triggered, leave both matchingRules and schedules empty:
startWhen:
matchingRules: []
schedules: []Deduplicate workflow runs
The runOnceFor option prevents duplicate workflow runs for the same incident, alert group, or other event source. Set it to a template that builds a key from the event data. The workflow runs once for each key.
Use ${...} segments for CEL expressions inside the template.
For example, setting runOnceFor to incident:${inputs.data.incidentID} means that if multiple events arrive for the same incident ID, the workflow runs only for the first event.
This is useful when you want to react to an incident exactly once, even if IRM sends several related events in quick succession.
spec:
runOnceFor: "incident:${inputs.data.incidentID}"
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.incident\\..*"Reference only event data
Workflows builds the deduplication key before the workflow starts, so the only part of the workflow context it can use is inputs.
This means runOnceFor can’t reference steps or resources. No step has run yet, and incident, alert group, and secret resources aren’t loaded. Referencing either one causes a validation error when you save the workflow.
Use the matching field from the event payload instead. For example, use ${inputs.data.incidentID} rather than ${resources.incident.event.incidentID}. To find the field names available for an event, refer to Step and trigger types reference.
Note
You can’t use
runOnceForon a workflow that has a schedule trigger. Workflows already runs each scheduled time once, so settingrunOnceForon a scheduled workflow causes a validation error when you save the workflow.
Combine event and schedule triggers
A workflow can have both event and schedule triggers. The workflow starts when any matching rule matches an incoming event or when any schedule fires.
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.incident\\.updated"
schedules:
- "0 9 * * 1-5"Next steps
Was this page helpful?
Related resources from Grafana Labs


