> For the complete documentation index, see [llms.txt](https://docs.riff.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.riff.ai/playbooks/finance/escalate-flagged-transactions.md).

# Escalate flagged transactions

**Best fit:** Agent (detection and routing) + App (approval queue) **ERP systems:** Infor LN / M3, SAP S/4HANA, Oracle ERP Cloud, Microsoft Dynamics 365 **Time to build:** \~35 minutes

***

## What you're building

A workflow that detects payment exceptions requiring approval — transactions above thresholds, unusual suppliers, policy violations, mismatches — and routes them to the right approver automatically. Approvers see a clean queue in a Riff App; they approve or reject with a reason; the decision is written back to your ERP.

***

## What you need

* Riff workspace with your ERP connected
* Your delegation-of-authority matrix (who can approve what up to which value)
* Read access to invoices, payment proposals, and AP exceptions
* Write access to update invoice/payment status in your ERP
* Approver email addresses or Slack handles

***

## Step 1: Define your escalation rules

Build your routing table before you start:

| Exception type               | Threshold     | Routes to             |
| ---------------------------- | ------------- | --------------------- |
| Invoice value above limit    | > €50,000     | Finance Director      |
| New supplier (first invoice) | Any value     | AP Controller         |
| Duplicate invoice            | Any value     | AP Controller         |
| Price mismatch               | > 5% variance | Buyer + AP Controller |
| Payment terms mismatch       | Any           | AP Controller         |

***

## Part 1: Build the detection agent

### Step 2: Create the agent

1. Click **+ New** → **Agent**
2. Name it — e.g. "Payment Escalation Agent"
3. Brief the agent with your routing table:

> You monitor the AP exception queue in \[ERP]. For each exception, you apply the escalation routing table. Invoices above €50,000 are flagged to the Finance Director. First-time supplier invoices go to the AP Controller regardless of value. Duplicate invoices go to the AP Controller immediately. Price mismatches above 5% go to both the buyer on the PO and the AP Controller. You create an approval request for each flagged item and send a notification to the approver. You do not approve any payment without explicit approval from the right authority level.

### Step 3: Connect and trigger

* **Integrations tab**: connect your ERP
* **Triggers tab**: schedule to run after each invoice processing batch, or set a real-time trigger if your ERP supports it

***

## Part 2: Build the approval App

### Step 4: Create the approval queue

1. Click **+ New** → **App** (or add a tab to an existing finance App)
2. Build a queue view:
   * Exception type and description
   * Invoice number, supplier, and value
   * Routing reason (why this needs approval)
   * Assigned approver
   * Days in queue
3. For each item, add **Approve** and **Reject (with reason)** buttons
4. When an approver acts, the agent writes the decision back to your ERP and logs it

### Step 5: Configure notifications

Brief the agent to send:

* A notification to each approver when a new item arrives in their queue
* A daily summary of open approvals (so nothing sits unactioned)
* An escalation alert if an item has been open for more than 24 hours without a decision

***

## What good looks like

* No payment exception sits unrouted for more than minutes
* Approvers have all the context they need in one view — no ERP login required to approve
* Every approval and rejection is logged against the invoice in your ERP
* Finance Director can see the full approval queue and override if needed

***

## Variations

**If your organisation uses email-based approvals:** Configure the agent to send an approval request email with approve/reject links, and process the reply.

**If thresholds vary by legal entity or cost centre:** Brief the agent with your full delegation matrix, keyed by entity, category, and value.

**If you use a third-party approval workflow (e.g. Coupa, Basware):** Integrate the agent with that system via its API — route exceptions there and sync decisions back to your ERP.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.riff.ai/playbooks/finance/escalate-flagged-transactions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
