# Operating staged documents

The in-client view of documents the API has imported but not yet posted. This is the internal clerk's workflow: review, edit, approve, process, and archive staged payments, expenses, and adjustments without touching the API.

Endpoints set to **Manual** or **Auto Draft** leave imported documents staged for a person to handle in Business Central. This topic is for that person: the clerk who works the documents in the client, not the integration developer. Give the clerk the `EONE Documents` [permission set](https://eonesolutions.github.io/eone-bc-integration/permissions.md) plus their normal Business Central role for posting.

## Where the documents are

From the **eOne Integration Setup** card's navigation, or via **Tell Me**:

- **Ledger Documents.** Imported customer, vendor, and employee payments, refunds, credit memos, invoices, deposits, and bank/G/L entries. One list with a Document Type column and a card per document, plus a saved view per endpoint so you can pin the list to the one you manage. It opens on either the **Ledger documents** or the **Bank / G/L entries** feature switch, since it carries the bank/G/L view as well.
- **Expenses.** Imported employee expense documents.
- **Inventory Adjustments.** Imported stock adjustments.

## The clerk's workflow

1. **Review.** Open a staged document. Fact boxes on the card show the context you need. A payment shows the customer's open entries and unposted sales; an expense shows the G/L account and running balance; an adjustment shows current availability.
2. **Edit** (where allowed). Whether you can add, edit or delete a document's lines depends on the endpoint's **Allow Manual Line Editing in UI** switch, and on the document's status - a document under approval or already approved is refused until you reopen it. The header itself stays read-only: it is integration-owned.

A document's lines are **one grid** with a **Line Type** column, the way a Business Central journal shows heterogeneous lines. An *Application* row settles a posted document; a *Distribution* row codes an amount to an account of its own and carries its own dimensions. The application lookup offers only the party's **open** entries, each showing the amount still remaining on it, and refuses an amount larger than that remainder, so a payment cannot be pointed at an invoice that is already settled.

1. **Approve** (if required). If the endpoint has **Requires Approval** set, choose **Send Approval Request** on the document to route it through the Business Central approval workflow; an approver then approves it (from the page, or the standard *Requests to Approve* page). Nothing processes until the document is **Approved**. See [Approval](#approval) below.
2. **Process.** Run **Process** to send the document to its journal. Depending on the endpoint's [processing mode](https://eonesolutions.github.io/eone-bc-integration/endpoint-setup.md) this posts it, or writes unposted draft lines for you to post with the batch.
3. **Archive or cancel** (optional). Archive keeps a snapshot; cancel snapshots and removes the open document. Both are available when the document type has archive/cancel enabled.
4. **Delete** (where allowed). A staged document that should never post can be deleted, taking its lines, attachments and notes with it. Two rules apply. A document that is **pending approval or already approved is never deletable** - cancel the approval request or reopen it first, so a document an approver is reviewing (or has signed off on) cannot quietly vanish. And the endpoint's **Allow Manual Delete** switch (on by default) can mark a whole document family integration-owned, refusing deletion of its staged documents outright. See [Endpoint setup](https://eonesolutions.github.io/eone-bc-integration/endpoint-setup.md).

## After it processes

A processed document does not disappear. It moves to **eOne Processed Documents**, the permanent record of everything that has been put through, and its card is where you check what a document actually did.

That card is laid out to match the staged cards: the same fast tabs in the same order, so a document you reviewed before processing reads the same way afterwards. **General** carries the identity, the amounts, and the posting result. **Lines** sits directly beneath it, showing the lines as they were at processing time. **Document Details**, **Vendor Remittance**, and **Dimensions** follow.

The fact boxes answer the questions history raises:

- **Document Balance.** The same arithmetic the staged card showed, split into what settled posted documents, what was coded to accounts of its own, and what was left on the party's account.
- **Posted G/L Entries.** The general ledger entries this document posted, on the card rather than a page away. Shown only once the document has posted.
- **Attachments.** The receipts and paperwork that arrived with the document, carried across from staging with it.
- **Open Customer** or **Open Vendor Entries.** What the party still owes, which is the question asked when someone reports that a payment is still showing as outstanding.

A document that stopped at draft lines has no posted entries to show. Use **Open Draft Journal** on it to reach the batch holding the lines, and post them there.

## Approval

Approval is a **Business Central** activity performed by a licensed user in the client. The API cannot approve a document. It uses Business Central's standard approval engine, so it honours Approval User Setup (the approver hierarchy and amount limits), delegation, the Approval Entry audit trail, and notifications.

To turn it on for a document type:

1. Set **Requires Approval** for the endpoint on the [eOne Integration Setup](https://eonesolutions.github.io/eone-bc-integration/endpoint-setup.md) card.
2. Enable a Business Central approval workflow for eOne documents on the standard **Workflows** page. A starter template ships to copy: **eOne Ledger Document Approval Workflow** (ledger and expense documents) or **eOne Inventory Adjustment Approval Workflow** (inventory). **Approval User Setup** must also name the approvers and their limits.

Then, on the *eOne Ledger Documents*, *eOne Expenses*, or *eOne Inventory Adjustments* page, the clerk chooses **Send Approval Request**; the approver uses the standard **Approve** / **Reject** / **Delegate** actions. The document's `status` moves Open → Pending Approval → Approved, and only an **Approved** document processes.

## Statuses to know

Every staged document is in exactly one of these. Approval is only a step when the endpoint requires it; **Process** posts the document or writes draft lines per the endpoint's [processing mode](https://eonesolutions.github.io/eone-bc-integration/endpoint-setup.md), and clears it from staging.

| Status | What it means | How it leaves |
| --- | --- | --- |
| **Open** | Imported and ready. Where every document starts. | **Process**, when the endpoint needs no approval - otherwise **Send Approval Request** |
| **Awaiting Lines** | Fewer lines have arrived than the header declared. Re-checked every job run. | On its own, once the rest arrive |
| **Pending Approval** | The request is with an approver. It will not process, and a manual **Process** is refused. | An approver **Approves** it |
| **Approved** | Cleared to process, automatically on the next job run or by hand. | **Process**, or **Reopen** back to Open |
| **Awaiting Invoice** | References an invoice by Integration Id that has not posted. Only where the endpoint allows referencing one. | On its own, once that invoice posts |
| **Error** | The last processing attempt failed; the **Error Message** field holds the reason. | Fix the cause, then **Reopen** back to Open |
| **Processed Documents** | No longer staged: sent to its journal, posted or as unposted draft lines. | Keeps its own status there - **Processed**, then **Posted** |

> **Tip:** If documents are piling up unexpectedly, check the endpoint's processing mode on the setup card. A type left on **Manual** waits for a person indefinitely by design.

**Next:** [Availability snapshot](https://eonesolutions.github.io/eone-bc-integration/availability-snapshot.md). Only needed if your integration consumes stock changes.
