Flow icon
Log icon

Executes flow on flow trigger with Not condition

Invert flow trigger conditions in Kestra using the Not operator. Execute downstream flows only when a specific upstream condition is not satisfied.

Categories
Core
id: flow-condition-not
namespace: company.team

triggers:
  - id: flow_condition
    type: io.kestra.plugin.core.trigger.Flow
    dependsOn:
      - when: "{{ not (trigger.namespace startsWith 'company.analytics') }}"

tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Demo for Not condition

Run a downstream flow in response to upstream executions while excluding a subset you do not care about, using a negated Pebble expression in a dependsOn when clause on a io.kestra.plugin.core.trigger.Flow trigger. This blueprint shows the negation pattern: react to every flow execution in your instance except those coming from the company.analytics namespace prefix. It solves the common event-driven problem where a catch-all flow listener fires too broadly and you need to carve out exceptions without enumerating every namespace you do want.

How it works

  • A single hello task of type io.kestra.plugin.core.log.Log runs when the flow is triggered, standing in for the real work you would orchestrate.
  • The flow_condition trigger of type io.kestra.plugin.core.trigger.Flow listens for executions of other flows.
  • Its dependsOn entry sets when: "{{ not (trigger.namespace startsWith 'company.analytics') }}", wrapping the namespace check in Pebble's not(...) to invert the result.
  • Because the expression is negated, the trigger fires for executions whose namespace does NOT start with company.analytics.

What you get

  • An event-driven listener that reacts to upstream executions across namespaces.
  • A clean exclusion rule instead of a long allowlist of namespaces.
  • A reusable negation pattern that works with both Flow and Schedule triggers.

Who it's for

  • Platform engineers building shared, instance-wide automation flows.
  • Data and DevOps teams that need audit, notification, or cleanup flows to run on most executions but skip a noisy or internal namespace.

Why orchestrate this with Kestra

Kestra evaluates the when Pebble expression declaratively in YAML at trigger time, so the negation logic lives next to the trigger rather than buried in task code. Event triggers fire automatically on upstream executions, retries and error handling are built in, and execution lineage is captured so you can trace which upstream run started which downstream flow. A standalone scheduler or cron cannot express "react to events from everywhere except this namespace"; Kestra's Pebble expressions (not(...), and, or, and string functions like startsWith) make that exclusion a one-line declaration.

Prerequisites

A running Kestra instance and at least one other flow that produces executions to listen for.

Secrets

This blueprint references no secrets. All logic is core orchestration and requires no external credentials.

Quick start

  1. Add this flow to a namespace in your Kestra instance.
  2. Adjust the namespace prefix inside the when expression to the prefix you want to exclude.
  3. Trigger some upstream flows in and outside that prefix.
  4. Confirm the hello task runs only for executions outside company.analytics.

How to extend

  • Swap the hello Log task for real work such as a notification, a Subflow, or a cleanup task.
  • Wrap not(...) around other checks, such as trigger.flowId, trigger.labels, or a states comparison, to invert different criteria.
  • Combine not(...) with and/or in the same when expression to build precise event filters.
  • Reuse the same negated expression in a Schedule trigger's top-level when property to skip certain calendar windows.

Links

Tasks
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.