Skip to content

Conditions

Conditions form the boolean expression that must be true for a rule's actions to be executed. All top-level conditions are combined with an implicit AND.

Conditions are evaluated after filters pass.


Field condition

Checks a document field value using an operator.

conditions:
  - field: title
    match: '^\d{4}/'          # regex match (re.search)

  - field: content
    contains: "Invoice No."   # substring match (case-sensitive)

  - field: page_count
    gt: 1                     # numeric: gt, gte, lt, lte

  - field: page_count
    eq: 5                     # exact equality

  - field: tags
    contains: "Inbox"         # list field: member check

  - field: custom_fields
    exists:                   # presence check (no value needed)

Supported operators

Operator Applicable to Description
eq strings, numbers Exact equality
contains strings, tags, custom_fields Substring match (strings) or member check (lists)
match strings Regex match using re.search
exists any field True if the field is not null/empty
lt numbers Less than
lte numbers Less than or equal
gt numbers Greater than
gte numbers Greater than or equal

Available document fields

title, content, correspondent, document_type, storage_path, tags, custom_fields, page_count, archive_serial_number, original_file_name, mime_type, owner, created, added, modified


Classifier shorthand

A compact form for checking classifier fields by name. Equivalent to a full field condition with eq.

conditions:
  - correspondent: "ACME GmbH"
  - document_type: "Invoice"
  - storage_path: "archive/invoices"

Variable condition

Checks a Jinja2 scope variable set by a previous action (match, set_variable, lookup).

conditions:
  - variable: invoice_number
    exists:

  - variable: invoice_number
    eq: "12345"

  - variable: invoice_number
    match: '^\d{4,6}$'

Template condition

Evaluates a Jinja2 expression. The expression must render to a truthy value.

conditions:
  - template: "{{ result is defined and result | length > 0 }}"

  - template: "{{ doc.page_count > 1 }}"

Logical operators

not

Inverts the result of its child conditions (all children must be false).

conditions:
  - not:
      - field: title
        match: '^\d{4}/'
      - field: tags
        contains: "Problem"

The rule only proceeds if the title does not match the pattern and the "Problem" tag is not present.

and

Explicit AND grouping (useful for nesting inside or).

conditions:
  - and:
      - correspondent: "ACME GmbH"
      - document_type: "Invoice"

or

At least one child must be true.

conditions:
  - or:
      - correspondent: "ACME GmbH"
      - correspondent: "ACME AG"

Combining operators

Operators can be nested to build complex expressions:

conditions:
  - or:
      - and:
          - correspondent: "ACME GmbH"
          - document_type: "Invoice"
      - and:
          - correspondent: "ACME AG"
          - document_type: "Invoice"
  - not:
      - field: tags
        contains: "Problem"

This reads as: (ACME GmbH invoice OR ACME AG invoice) AND not tagged as Problem.