Workflows, alerts and insights

Rules

"When this happens, if that is true, do this." Rules are how Logley reacts to documents without you watching for them.

ABOUT 10 MINUTES5 SECTIONSCHAPTER 7 OF 19GETTING STARTED · STEP 7 OF 7

Reached from Settings → Monitoring → Rules, or at /rules. The Settings menu lists it only for roles that can manage rules and read alerts (by default Admin and Editor). Only they can create, change or delete a rule, and reading the list needs alerts.read, as a rule is what raises an alert.


The rule list

Each rule shows its name, its trigger, how many conditions it has, and what it does — for example:

High-value invoice · 148 alerts Document read → 2 conditions → Create alert · warning +2

The +2 means the rule has two further actions beyond the one shown.

The alert count is how many of the alerts this rule raised are still unresolved; resolving one takes it off the count. It is hidden at zero, so a rule without a Create alert action never shows one, however often it fires. A count that keeps climbing can mean the rule is too broad, or that nobody is resolving its alerts.

The toggle on the right enables or disables a rule. Disabling keeps the rule and its history — prefer it to deleting when you are experimenting.

Click the arrow at a rule's left to open it. Edit rule makes its name and diagram editable in place until you click Save or Cancel. Duplicate adds a disabled copy with (copy) after its name, and Delete asks you to confirm first.

Filter with Trigger and Status (Active / Disabled) at the top.


The four triggers

TriggerFires when
Document readThe document has been read, classified and, where its type has fields, extracted
Extraction completeFields have been pulled out of the document
Document processed (ready)The document has been marked ready, or left in review. Auto-approval comes after it, so a rule here cannot see whether an invoice was auto-approved. It does not fire for a document with no readable text
Email receivedAn email arrives in a connected mailbox

No rule runs when a document arrives. Document read was called Document Ingested until November 2026; existing rules keep working under the new name. A document that stops before extraction never reaches these triggers: correspondence that is skipped, a file split into parts (the parts do reach them), a locked PDF, or a file that could not be read.

Choose by what your condition needs. Document read and Extraction complete fire one straight after the other and see the same extracted values, so an amount condition can match at either; Extraction complete only skips documents with nothing extracted. A rule that tests whether the document ended up ready or in review belongs on Document processed (ready). Changing a document's type or clicking Re-extract runs the first two again, so their alerts can repeat.


Building a rule

New rule opens with this starter rule: a trigger, one condition and one action.

New rule opens a visual editor — a flow chart, not a form.

Nodes are laid out left to right:

TRIGGER                WHEN                          THEN
Document read  →   Document Type is INVOICE  →   Create alert · warning

The toolbar gives you three building blocks:

  • Add condition — one test, e.g. Document Type is INVOICE.
  • Group — combines conditions with AND / OR when one test is not enough.
  • Add action — what to do.

Click a node to change it in the panel that opens on the right. That is where you pick the trigger (Trigger event), a condition's Field, Operator and Value, a group's Match, and an action's type (Action) and settings.

A condition's Field is either one of the document's own fields (Document Type, Status, Supplier, Filename, Ingestion Source) or a value read out of the document. The list offers the ones every invoice carries (Gross Amount, Currency, Invoice Number, the dates) and the two ends of the route (Route Origin, Route Destination). Anything else the extraction produced you can type as extracted.<name>, such as extracted.carrier_name on a CMR. A field the engine cannot resolve is flagged under the box before you save.

An Email received rule offers the email's own fields instead (Subject, From (sender), Sender domain, Has attachment, Body), and it is simpler than the canvas suggests: every condition must match (groups and ANY (OR) are ignored), and then its actions run whichever branch they hang from, with at most one reply per email. A rule with no condition never fires.

Connect nodes by dragging from a node's handle. The handle colours are the logic:

  • green = the true branch,
  • red = the false branch,
  • purple = membership in a group.

The false branch is the useful part: one rule can both alert on a high-value invoice and do something else with everything below the threshold.

Keyboard

KeyDoes
DelRemove the selected node or edge
Ctrl/⌘ + SSave
Ctrl/⌘ + ZUndo
Ctrl/⌘ + Shift + ZRedo
EscClose the editor

Name the rule in the field at the top, then Save. Closing with Esc, or by clicking outside the editor, does not save.


What rules can do

On the three document triggers a rule can Create alert at a chosen severity, Set tag on the document, or Set status, which with needs_review sends the document to review. On Email received it can Create alert, Draft email reply (which is what fills the Email queue) or Send email reply, which sends without review only when Automatic replies is switched on in Settings and otherwise leaves a draft.

An alert's title is optional. Leave it blank and the alert reads rule name: document name, or just the rule's name on Email received. View Rule on the alert brings you back to the rule that raised it.

Templates in actions

Alert text on the three document triggers can include {{field}} placeholders, filled from the document.

A placeholder names a field exactly as a condition would. That is the whole rule for getting them right: {{supplier}}, {{document_type}}, {{filename}}, {{status}}, {{ingestion_source}} — and anything read out of the document under its extracted. name, such as {{extracted.invoice_number}} or {{extracted.gross_amount}}. A bare {{gross_amount}} resolves to nothing, because no condition could name it either.

If a field cannot be resolved, the placeholder is left in the text exactly as written. For an internal alert that is a useful signal.

An Email received rule works differently. Its alert text is used as written, and a reply takes its text from the template picked in Reply template, whose placeholders are filled from the email and its sender: {{supplier_name}}, {{subject}}, {{from}}, {{from_domain}} and {{date}}. Any placeholder the email cannot fill is removed, which can leave a sentence reading oddly, so read each draft in the Email queue before you send it.


A complex rule, worked through

The starter rule is one trigger, one condition, one action. A real one usually has to say "either of these, but only for those" — and then do something different with what it does not match. This is that rule, and every part of it can be built in the editor.

Unattended customs paperwork. Customs declarations and consignment notes that nobody uploaded by hand (they arrived by email or appeared in the watched folder) or that look like a scan, are held for review, tagged, and announced. Anything else of those two types is tagged and left alone, because a person already has it in view.

TRIGGER  Document read

WHEN     match ALL:
         · Document Type in CUSTOMS, CMR
         · match ANY:
           · Ingestion Source in email, file_watch
           · Filename contains scan

THEN     If matches   → Create alert · warning
                      → Set status · needs_review
                      → Set tag · unattended
         Otherwise    → Set tag · desk

Every field it tests is set by the time Document read fires, so it can run at the earliest trigger.

Building it

  1. Select the starter condition and press Del, then do the same with its action. Add a Group, set it to ALL (AND), and drag from the trigger's handle to it. Drag from the group's purple handle to add the first condition, Document Type in CUSTOMS, CMR.
  2. From that same purple handle, add a second Group and set it to ANY (OR). A group can be a member of a group — that is how "either of these, but only for those" gets said once.
  3. Give the inner group its two conditions.
  4. Drag from the outer group's green handle to each of the three actions, and from its red handle to the single action that runs when the rule does not match. Releasing a drag on empty canvas offers Create & connect; choose Action there to create each one already wired.

The alert's text can name the document it is about: Unattended {{document_type}} — {{filename}} reads as Unattended CUSTOMS — SAD-2026-0412-scan.pdf on the alert.

Why it is shaped that way

  • in list is the OR you do not need a group for. Two tests on the same field joined by ANY (Ingestion Source is email OR is file_watch) are one condition: in email, file_watch. Reach for a group when the tests are on different fields, as the inner one here is.
  • Every action on a branch runs. The three under If matches all fire; they are not alternatives, and they are not ordered.
  • Set status · needs_review is not an ordinary status change. It flags the document for review and records the rule's name as the reason: the document's page shows Flagged by a rule followed by the rule's name. The reverse is not a rule's to do: a Set status on a document that is already waiting in review leaves it there, whatever the status, because only a person clears a review.
  • The false branch is where the rule earns its keep. Without it you need a second, negated rule, kept in step with the first one for ever.

Reading it back

A rule this size is hard to check on a canvas, so each rule has Graph and Outline tabs. Outline is the same rule as indented text (TRIGGER, WHEN match ALL (AND):, If matches, Otherwise, THEN), and it is the quickest way to confirm which actions hang off the false branch. It is read-only; starting an edit switches back to Graph.

What the editor will not save

  • a group with no members,
  • an action the trigger cannot reach by following connections from it (a purple membership connection does not count),
  • a loop,
  • an alert with no severity, or a Set status / Set tag with nothing to set,
  • a Set status to an approval status — ready, pending_approval, auto_approved, approved, rejected, changes_requested, on_hold or deleted, in any capitalization. A rule is not an approver: those statuses belong to people and to auto-approval. A rule saved earlier that sets one still runs its other actions, but not that one.

A refused save lists each problem in a red banner above the canvas, for example A group must contain at least one condition. The message names the kind of problem but not the node, so check every node of that kind.


Was this guide useful?

If something was missing or unclear, the contact page says where to write.

Contact