# Inventory Adjustments _(Realtime-enabled)_

`GET` `POST` `PATCH` `DELETE` _(Table: EONE Inventory Adjustment)_

```
eOne/core/v1.0/inventoryAdjustments
```

Adjust on-hand stock as its own header/line document, a header with an `inventoryAdjustmentLines` child collection, one line per item/variant/location. Backed by a dedicated staging table (the same model as [Customer Payments](https://eonesolutions.github.io/eone-bc-integration/core-customerPayments.md)), so it can be reviewed and approved in Business Central before it reaches the item ledger.

## Count vs. Increment

Each line is either a **Count** (`quantity` is the counted on-hand; the delta is computed against current inventory) or an **Increment** (`quantity` is a signed delta applied directly). Lines that net to zero are skipped. Resolve the item with `itemNumber` or `itemIntegrationId`. See [Resolver fields](https://eonesolutions.github.io/eone-bc-integration/resolvers.md).

## Processing is configurable

As with payments, how a staged adjustment reaches the item ledger is set on the **eOne Integration Setup** page (Inventory Adjustments tab): **Manual** (call `process`, or use the in-product *eOne Inventory Adjustments* page) builds **unposted** item journal lines; **Auto Draft to Journal** builds them in the background; **Auto Post** also posts them. An optional approval gate works the same way, enabled per endpoint by **Requires Approval** plus an enabled Business Central approval workflow, and driven from the client (not the API), see the bound-actions note below.

> **Note:** Name the target item journal with `journalTemplateName` + `journalBatchName`, or leave them blank to use the defaults from Setup. Auto Post posts only that adjustment's own lines, so the batch can be shared with other drafts. The template must be a Type = Item journal (Revaluation, Phys. Inventory, and Transfer templates cannot post the quantity adjustment lines).

## Bound actions

Invoke with `POST /inventoryAdjustments(<id>)/Microsoft.NAV.<action>`:

- `validate`: re-runs the document's checks (items, quantities, journal names) **without** processing it, reporting any problem in `status` / `errorMessage`. The response redirects back to the adjustment.
- `process`: turns the staged adjustment into item journal lines (unposted draft, or posted, per the Setup policy above).
- `post`: processes the adjustment **and posts it**, whatever the Setup policy says. Use it when SmartConnect decides that this one adjustment goes to the item ledger now, rather than an administrator putting the whole endpoint on Auto Post. Only the lines this adjustment just wrote are posted, so other drafts sitting in the same item journal batch are left alone, and the approval gate applies exactly as it does to `process`.

`process` and `post` return no body. The staged adjustment deletes itself the moment its item journal lines exist, so there is nothing to echo, and the outcome lives on the [Processed Documents](https://eonesolutions.github.io/eone-bc-integration/core-processedDocuments.md) row the same call wrote. Fetch it by the `integrationId` you sent the adjustment with - `processedDocuments?$filter=integrationId eq '<your id>'` - and read `postedDocumentNumber`, `postedPostingDate` and `status`; after `post` they are already filled in. An adjustment posts to the **item ledger**, so its `glTransactionNumber` stays 0. A rejected call returns the error and leaves the adjustment in staging, with `errorMessage` describing the problem, ready to correct and retry.

> **Note:** Approval is not done through the API. When an endpoint has **Requires Approval** set and a Business Central approval workflow is enabled for eOne documents, an adjustment must be **Approved** before it processes. A licensed user sends it for approval and approves it in Business Central, on the *eOne Inventory Adjustments* page (**Send Approval Request**, then the standard Approve/Reject/Delegate), backed by Approval User Setup. The read-only `status` (Open → Pending Approval → Approved) and `errorMessage` fields report where the document is; a failed automatic attempt lands `status` = Error with the reason in `errorMessage`.

## What a DELETE may do

A staged adjustment that is pending approval or already approved cannot be deleted; cancel the approval request or reopen it first, so what the approver signed off on is what posts. A DELETE is also refused when the endpoint's **Allow Manual Delete** switch is off on the eOne Integration Setup page (Inventory Adjustments tab). It is on by default, so nothing changes until an administrator turns it off to mark adjustments integration-owned.

## Dimensions and per-line notes

Set `shortcutDimension1Code`–`8Code` on the **adjustment header**; they are applied to every generated item journal line. Each line also takes an optional `comment` (e.g. the reason for the count), which is carried onto that line's journal description. See [Dimensions](https://eonesolutions.github.io/eone-bc-integration/dimensions.md).

## Inventory Adjustments fields

_API column → BC field._

**Legend**

- _(req)_ required on create
- _(res)_ resolver
- _(cur)_ currency-translated
- _(ro)_ read-only
- _(ext)_ added to this endpoint by another extension (BC field name shown; its API column name is not known here)

| API | BC field | Notes |
| --- | --- | --- |
| `id` | SystemId | _(ro)_ |
| `bcCompanyId` | bcCompanyId | The company this row belongs to - the same GUID that appears in the request URL. Present on every endpoint so a store pooling several companies can keep them apart without relying on which URL it called. _(ro)_ |
| `bcCompanyName` | bcCompanyName | The name of the company this row belongs to. _(ro)_ |
| `documentNumber` | Document No. |  |
| `postingDate` | Posting Date |  |
| `description` | Description |  |
| `expectedLineCount` | Expected Line Count | How many lines this adjustment will have when it is complete. Set it on the header and the adjustment is not processed until that many have arrived, instead of waiting out the five-minute idle window. Leave it blank (the default) to keep the idle-window behaviour. There is no value-total equivalent for adjustments: they carry quantities, and count-mode and increment-mode lines cannot be summed together. |
| `integrationId` | EONE Integration Id |  |
| `journalTemplateName` | Journal Template Name |  |
| `journalBatchName` | Journal Batch Name |  |
| `status` | Status | Workflow state: Open, Pending Approval, Approved or Error. _(ro)_ |
| `errorMessage` | Error Message | Why the last automatic processing attempt failed. _(ro)_ |
| `shortcutDimension1Code` | Shortcut Dimension 1 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension2Code` | Shortcut Dimension 2 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension3Code` | Shortcut Dimension 3 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension4Code` | Shortcut Dimension 4 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension5Code` | Shortcut Dimension 5 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension6Code` | Shortcut Dimension 6 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension7Code` | Shortcut Dimension 7 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `shortcutDimension8Code` | Shortcut Dimension 8 Code | Dimension applied to every item journal line of the adjustment. See Dimensions. |
| `createdDateTime` | SystemCreatedAt | When the integration imported this document into staging. _(ro)_ |
| `errorDateTime` | Error Date-Time | When the document last entered Error. Cleared when it is approved or reopened. _(ro)_ |
| `lastModifiedDateTime` | SystemModifiedAt | _(ro)_ |

## Related pages

Collections nested under this endpoint:

- [Adjustment Lines](https://eonesolutions.github.io/eone-bc-integration/core-inventoryAdjustmentLines.md)
