Skip to main content

Overview

The Rules Engine lets you define conditions and actions that fire automatically β€” no code required. Rules can trigger on document events, case status changes, or a recurring schedule. Navigate to Rules Engine in the sidebar to manage your rules.

Trigger Types

πŸ“₯ Document Event

Fires immediately after a document is processed and reaches Ready status. Available events:
  • document_ready β€” fires after every successful AI extraction
Use case: Flag low-confidence documents, create cases for review, move documents to folders, notify your team.

πŸ“‹ Case Event

Fires when a case changes to a specific status. Available events:
EventWhen it fires
case_resolvedCase marked as Resolved
case_closedCase marked as Closed
case_readyCase marked as Ready
case_in_progressCase marked as In Progress
case_newNew case created
case_backlogCase moved to Backlog
Use case: Auto-approve documents when their linked case is resolved. Trigger webhooks to external systems on case completion.

⏰ Schedule (Heartbeat)

Scans all documents on a recurring timer. Configure the interval in minutes (e.g. every 60 minutes). The rule evaluates every document that matches its conditions on each scan. Use case: Alert on documents stalled in Needs Review for more than 3 days. Weekly compliance checks.

Conditions

Each rule supports up to 5 conditions combined with AND logic.
FieldAvailable Operators
confidence_scoregreater than, less than, equal to
total_amountgreater than, less than, equal to
statusequals, contains
doc_typeequals, contains
vendor_nameis empty, is not empty, contains
days_in_statusgreater than (heartbeat only)
Any custom fieldequals, contains, is empty

Actions

ActionWhat it does
set_statusChanges the document status
create_caseCreates a new case linked to the document
move_folderMoves the document to a specified folder
notifyCreates an in-app notification
webhookPOSTs a payload to an external URL
flag_reviewSets status to Needs Review

Multi-Step Approval Workflows

Case-event rules enable chained automation across documents and cases. Example: Low confidence β†’ human review β†’ auto-approve
Rule 1 (Document Event):
  Trigger: document_ready
  Condition: confidence_score < 70
  Action: create_case (priority: High)

Rule 2 (Case Event):
  Trigger: case_resolved
  Action: set_status β†’ Approved

Rule 3 (Document Event):
  Trigger: document_ready (status = Approved)
  Action: webhook β†’ QuickBooks endpoint
When a document extracts at 65% confidence, Rule 1 creates a High-priority case. An accountant reviews the document, resolves the case. Rule 2 fires and auto-approves the document. Rule 3 fires and exports to QuickBooks.

Loop Protection

The Rules Engine includes automatic loop detection. If a rule chain triggers itself recursively, execution stops after 5 levels of depth. Example of a loop that would be caught:
case_resolved β†’ set_status Approved β†’ document event β†’ create_case β†’ case_resolved β†’ ...
The system logs a warning and stops execution at depth 5. No infinite loops are possible.

Default Rules

Every fresh RecordEngine deployment seeds 3 default rules:
RuleConditionAction
Low Confidence Extractionconfidence_score < 70create_case (High)
Invoice Missing Vendor Namedoc_type contains invoice AND vendor_name is emptycreate_case (Medium)
Large Invoice Requires Approvaltotal_amount > 10000create_case (High)
These can be edited, disabled, or deleted from the Rules Engine page.

Execution Log

Every rule firing is recorded in the Rule Execution Log at the bottom of the Rules Engine page. Each entry shows:
  • πŸ“₯ Document event / πŸ“‹ Case event / ⏰ Heartbeat icon
  • Rule name and document/case it fired on
  • Action taken and whether it succeeded
  • Timestamp
The Automation Flow graph in each document’s detail view shows the visual chain of events for that specific document.

API

Rules can also be managed via the REST API. See API Reference β†’ Rules for full endpoint documentation.