Public preview Grafana Cloud
Last reviewed: October 13, 2026

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

  1. Select Event as the trigger type when creating or editing a workflow.
  2. 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:

YAML
startWhen:
  matchingRules:
    - eventNameRegex: "grafana_irm_app\\.incident\\.updated"

You can define multiple matching rules. The workflow triggers if any rule matches:

YAML
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:

AppResourceEventExample event nameDescription
grafana_irm_appincidentupdatedgrafana_irm_app.incident.updatedFires any time an incident is created or updated.
grafana_irm_appalertgroupupdatedgrafana_irm_app.alertgroup.updatedFires any time an alert group is created or updated.
grafana_irm_appscheduleupdatedgrafana_irm_app.schedule.updatedFires 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.

text
minute  hour  day-of-month  month  day-of-week

Add a schedule trigger in the editor

  1. Select Schedule as the trigger type when creating or editing a workflow.
  2. 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:

YAML
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:

YAML
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):

FieldRangeSpecial characters
Minute0-59*, ,, -, /
Hour0-23*, ,, -, /
Day of month1-31*, ,, -, /
Month1-12*, ,, -, /
Day of week0-6 (0 is Sunday)*, ,, -, /

The following examples show common schedule patterns:

ScheduleMeaning
0 9 * * 1-5Every weekday at 9:00 AM UTC
CRON_TZ=America/New_York 0 9 * * 1-5Every 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:

  1. Click Run in the editor header.
  2. 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:

YAML
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.

YAML
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 runOnceFor on a workflow that has a schedule trigger. Workflows already runs each scheduled time once, so setting runOnceFor on 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.

YAML
startWhen:
  matchingRules:
    - eventNameRegex: "grafana_irm_app\\.incident\\.updated"
  schedules:
    - "0 9 * * 1-5"

Next steps