> 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/procurement/handle-delivery-exceptions.md).

# Handle delivery exceptions

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

***

## What you're building

An agent that monitors inbound deliveries and flags exceptions automatically — short deliveries, wrong items, quantity mismatches, damaged goods. The flagged exceptions appear in a team App where your warehouse or procurement team can action them: raise a debit note, contact the supplier, or update the PO.

***

## What you need

* Riff workspace with your ERP connected
* Read access to goods receipt records and purchase orders
* Write access to create exception records or notes in your ERP
* An agreed classification for exception types (short delivery, wrong item, quality reject, etc.)

***

## Part 1: Build the detection agent

### Step 1: Brief the agent

Create a new Agent and describe the job:

> You monitor goods receipts in \[ERP] as they are posted. For each receipt, you compare the received quantity and item against the corresponding purchase order line. If the received quantity is more than 5% below the ordered quantity, you flag it as a short delivery. If the item code or description doesn't match the PO, you flag it as a wrong item. If a quality rejection code is posted alongside the receipt, you flag it as a quality exception. For each exception, you create an exception record in \[ERP] with the receipt number, PO number, supplier, exception type, and discrepancy detail.

### Step 2: Connect and trigger

* **Integrations tab**: connect your ERP
* **Triggers tab**: add a schedule trigger (e.g. every 4 hours during business hours, or after each shift's GR batch)

***

## Part 2: Build the action App

Your team needs a screen to see and action the exception queue.

### Step 3: Create the App

1. Click **+ New** → **App**
2. Name it — e.g. "Delivery Exception Queue"
3. Build a table view showing:
   * Exception type
   * Supplier and PO number
   * Received vs ordered quantity
   * Date received
   * Assigned to (blank until claimed)
   * Status (New / In progress / Resolved)

### Step 4: Add action buttons

For each exception, add buttons that trigger the appropriate workflow:

| Button                | What happens                                                           |
| --------------------- | ---------------------------------------------------------------------- |
| Raise debit note      | Agent drafts a debit note against the supplier and adds it to your ERP |
| Contact supplier      | Agent drafts an exception notification email for review before sending |
| Accept short delivery | Closes the exception and updates the PO quantity                       |
| Reject delivery       | Flags the receipt for return and creates a return-to-supplier record   |

### Step 5: Assign and notify

Configure the agent to:

* Assign exceptions to the right team member based on category or supplier
* Send a daily summary of open exceptions to the procurement lead

***

## What good looks like

* Exceptions are flagged within minutes of a goods receipt being posted
* Every exception has a clear status and owner in the App
* Supplier correspondence and ERP updates are logged against the exception
* Nothing falls through the cracks between shifts or handovers

***

## Variations

**If your team works on mobile:** Build the App with a mobile-friendly layout and enable push notifications for new high-priority exceptions.

**If debit notes need approval:** Add an approval step in the App before the agent raises the debit note in your ERP.

**If you want to track exception rates by supplier:** Add a dashboard tab to the App showing exception volume, type, and resolution time by supplier — useful for supplier performance reviews.


---

# 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/procurement/handle-delivery-exceptions.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.
