How Rules Work
Rules automate the repetitive decisions in your accounts payable workflow. Instead of manually coding the same vendor to the same GL account every month, or flagging the same type of invoice for review every time, you define the logic once and Mod AI applies it automatically.
What Rules Do
Rules tell Mod AI how to handle specific situations without waiting for you to intervene. They cover three areas:
- Extraction behavior -- Modify how the AI interprets documents (e.g., "always read the second page for the total").
- Matching logic -- Control how invoices are matched to POs (e.g., "match Office Depot invoices to PO-5001").
- GL coding decisions -- Automate account assignment (e.g., "code all Staples invoices to account 5200 Office Supplies").
Three Stages Where Rules Apply
Rules are evaluated at different stages of the invoice lifecycle:
1. Extraction
Extraction rules influence how the AI reads and interprets incoming documents. Use these when the AI consistently misreads a specific vendor's invoice format, or when important data appears in an unusual location on the document.
2. Matching
Matching rules control how invoices are linked to purchase orders and receipts. Use these when you want specific invoices to match to specific POs, or when certain vendors should skip the matching step entirely.
3. Coding
Coding rules automate GL account and dimension assignment on invoice line items. Use these when the same vendor or expense type should always be coded to the same accounts.
Priority Ordering
Rules are evaluated in priority order. Each rule has a priority number -- lower numbers are evaluated first. The first matching rule wins, and subsequent rules for the same field are skipped.
For example, if you have two coding rules that both apply to a Staples invoice:
- Priority 1: "Code Staples office supplies to account 5200"
- Priority 2: "Code Staples to account 5100"
The first rule wins because it has the higher priority (lower number).
Vendor-Specific vs Global Rules
Rules can be scoped in two ways:
- Vendor-specific rules apply only to invoices from a particular vendor.
- Global rules apply to all invoices regardless of vendor.
Vendor-specific rules always take precedence over global rules, regardless of priority number. This means a vendor-specific rule with priority 10 still beats a global rule with priority 1.
How Rules Interact with AI
Rules override the AI's suggestions. If a rule says "code to account 5200", the AI's suggestion is replaced with the rule's value. The AI still processes the invoice and makes its own suggestions for any fields not covered by rules.
Rules don't replace the AI -- they guide it. Use rules for consistent, repeatable decisions. Let the AI handle everything else.
Learn More
- Creating a Rule -- Step-by-step instructions for building rules.
- Rule Conditions & Actions -- Every condition type and action type explained.
- Common Rule Examples -- Real-world examples you can adapt for your organization.