# How to automate inbound email in SAP Business One

> Source: https://netray.co/integrations/sap-business-one-email-automation
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

Read a shared inbox, extract order or quote data with rules and a language model, match it to Business Partners and Items, then create Drafts through the Service Layer for a clerk to review. Post only when confidence is high and the checks pass.

## System

SAP Business One

## Capability

email-automation

## Intro

Business One users spend a surprising share of the day retyping emails: customer purchase orders as PDFs, RFQs in the body text, supplier acknowledgements with new dates. The order desk is a human OCR layer between a mailbox and the Sales Order screen.

B1 can send email (from documents, via Alerts, or through the mailer in the client) but has nothing native for reading and understanding inbound mail. The pieces are available though: IMAP or Microsoft Graph for the mailbox, extraction for the content, and the Service Layer to create drafts.

This page focuses on the order-desk case, because the hard parts are the same everywhere: matching messy names to master data, preventing duplicates, and deciding what a machine may post by itself.

## Use Cases

### Customer PO to Sales Order draft

**Description:** Detect an email with a PO attachment, extract customer, PO number, items, quantities and requested dates, and create a Sales Order draft with the customer PO reference field filled in.

### RFQ to Sales Quotation

**Description:** Read a request with part numbers and quantities, look up Items and price lists, and prepare a Quotation draft for the estimator.

### Supplier acknowledgement updates

**Description:** Parse order confirmations from suppliers, match them to open Purchase Orders and propose new row ship dates for the buyer.

### Shipping advice matching

**Description:** Read ASN-like emails from suppliers and link tracking numbers to Purchase Orders or inbound goods.

### Customer questions triage

**Description:** Classify 'where is my order' emails, pull status from B1 and draft a reply for a person to send.

### Duplicate and change detection

**Description:** Notice that a new PO email matches an existing customer PO number and flag it as a change rather than a new order.

## System Surface

- Service Layer: create Drafts (Drafts entity with an object type for Sales Order or Purchase Order) or documents directly; Drafts keep a human in the loop and use the same validation as the UI when converted.
- Attachments2: upload the original email or PDF and link it to the document through the attachment entry, so the source is stored with the transaction.
- Matching data: Business Partners (OCRD), catalog numbers and customer-specific catalog numbers (the BP catalog numbers table), bar codes, and Item master (OITM) for resolving customer part numbers to your item codes.
- Document header fields such as the customer reference number (NumAtCard) used for duplicate checks.
- Mailbox side: Microsoft Graph for Microsoft 365, IMAP or EWS for others; B1's own mailer is for outbound only.

## How It Works

### Dedicate a mailbox

**Detail:** Use a shared address such as orders@ so ingestion is explicit. Process only that mailbox and move handled mail to folders by outcome.

### Classify and extract

**Detail:** Detect message type (PO, RFQ, acknowledgement, other). Extract fields from body and attachments; for scanned PDFs use OCR first (see the document OCR approach).

### Resolve the sender

**Detail:** Match sender domain and address to a Business Partner contact. Unknown senders go to a manual queue, not auto-created.

### Map parts and units

**Detail:** Resolve customer part numbers via customer catalog numbers, then item description fuzzy match with a threshold; check unit of measure and pack size.

### Validate

**Detail:** Check duplicate NumAtCard, credit status, price against list and quantities against sane limits.

### Create a Draft and attach source

**Detail:** Post the Draft through the Service Layer, attach the original, and tag the extraction confidence in a UDF.

### Notify the reviewer

**Detail:** Send a link to the draft to the order desk. Reviewer corrects and posts from B1; corrections feed a list of known mappings.

## Example Flows

### PDF purchase order from a regular customer

**Trigger:** An email from a known contact arrives with a PO PDF.

**Steps:**

- Extract PO number, ship-to, lines, and requested date.
- Look up each customer part number in the BP catalog numbers; all resolve with exact matches.
- Check NumAtCard for duplicates; none found.
- Create a Sales Order draft with the PDF attached and confidence marked High.

**Result:** The clerk reviews the draft and posts it in a minute instead of keying it.

### Supplier moves a delivery date

**Trigger:** A supplier reply says line 2 of PO 2291 moves by two weeks.

**Steps:**

- Match the PO number and line in the body to an open Purchase Order.
- Build a proposed change: row ship date plus the supplier's note.
- Create an Activity for the buyer with the proposal and a link to the PO.
- Buyer accepts and edits the PO; nothing is changed automatically.

**Result:** Expedite decisions use fresh dates, and every date change has a source email.

## On Prem

Inbound email often contains customer drawings, pricing and contractual terms, which many B1 customers do not want sent to a public AI service. Run extraction on a local open-weight model on your own GPU or CPU server, and run OCR locally too. The mailbox itself can stay on Microsoft 365 or on-prem Exchange; the service reads it via Graph or IMAP from inside your network and talks to the Service Layer on the same LAN. Only the finished draft goes to B1, and only the original attachments go to the attachments folder configured for the company. This keeps content on infrastructure you control while still removing the typing.

## Security

- Treat email as untrusted input: strip active content, limit attachment types and size, and scan for malware before processing.
- Defend against prompt injection in email bodies by never letting extracted text choose tools or change instructions; the extractor returns data only.
- Do not auto-create Business Partners or change bank details from email; those are classic fraud paths.
- Keep an audit log linking message ID, extraction output and the B1 draft.
- Use a restricted integration user allowed to add drafts but not post or cancel documents.

## Options

### Rules plus templates per customer

**Fit:** Works when a few large customers send the same PO layout every time.

**Effort:** Days per template; brittle when layouts change.

### In-house pipeline with a language model

**Fit:** Fits when you have developers and a variety of senders, and are prepared to maintain mappings.

**Effort:** Four to eight weeks to a reviewed-draft stage.

### Partner-led build (Netray with a B1 partner)

**Fit:** Fits when privacy requires local models or when volume and variety make accuracy tuning the main risk.

**Effort:** Scoped project with a pilot on one mailbox before widening.

## Pitfalls

- Auto-posting orders with a high-confidence score but unchecked units of measure leads to ten-fold quantity errors.
- Reply-chain emails repeat old POs; dedupe on PO number and message thread, not just message ID.
- Customer part numbers that look alike (suffix revisions) need strict matching, not fuzzy.
- Not storing the source email makes audits and disputes painful.

## Faq

### Can SAP Business One read incoming email on its own?

**Answer:** No. B1 sends email but has no built-in way to parse inbound messages into documents. You need a small service that reads the mailbox and creates drafts via the Service Layer or DI API.

### Should the system post orders automatically?

**Answer:** Start with drafts. After a few weeks of measured accuracy per customer, you can allow auto-posting for narrow cases, such as repeat customers with exact catalog matches and a value limit.

### What about attachments and scanned PDFs?

**Answer:** Scans need OCR before extraction. Text PDFs can be parsed directly. Keep the original attached to the draft through Attachments2 so reviewers can compare.

### Do I need the DI API?

**Answer:** Usually the Service Layer is enough and easier to host. The DI API is Windows-based and tied to a client install, but some older add-ons and complex objects still rely on it.

### How accurate will it be?

**Answer:** It depends on sender variety and the cleanliness of your catalog numbers. Expect strong results on repeat customers and weaker ones on new senders; measure field-level accuracy during a pilot and tune thresholds from that.

## Search terms

sap business one email automation, sap b1 purchase order email to sales order, automate sap business one order entry, sap business one inbound email, sap b1 rfq email automation, email to sales order draft sap b1, sap business one service layer create draft, sap b1 order desk automation, read emails into sap business one, sap business one email parsing

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
