upsert_manufacturing_order
Create a new manufacturing order or update an existing one in inFlow Inventory. When an ID is provided, it patches fields and merges line items; otherwise, it creates a new order.
Instructions
[LEGACY IMMEDIATE WRITE — HIGH RISK: BYPASSES INFLOW_ENABLE_SAFE_WRITES] Use set_manufacturing_order instead. Create a new manufacturing order or update an existing one. When id is provided, performs a partial update: unmentioned header fields and line items are preserved, outputSerialNumbers/outputQuantity patch the parent output line in place, inputLines[] patches merge into existing component lines by id (or unambiguous productId), and any deleteInputLineIds are removed. Without id, creates a new MO from outputProductId, outputQuantity, optional inputItems, and optional outputSerialNumbers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Order ID (required for updates) | |
| remarks | No | ||
| orderDate | No | Order date (ISO format) | |
| timestamp | No | Rowversion for optimistic concurrency — pass the value from the last GET | |
| inputItems | No | Input/component items (used for create only — unused on updates) | |
| inputLines | No | Input-line patches for updates. Each entry merges into an existing component line by `id` (or unambiguous `productId`); entries with no match are appended as new lines. Set `quantity`, `serialNumbers`, or `sublocation` to patch those fields; omit to preserve them. | |
| locationId | No | Location ID | |
| isCancelled | No | Set true to cancel the MO while preserving the rest of its state | |
| isCompleted | No | ||
| orderNumber | No | Order number (e.g. MO-SYNTHETIC-001) | |
| pickRemarks | No | ||
| customFields | No | ||
| requiredDate | No | Required completion date (ISO format) | |
| outputQuantity | No | Quantity to manufacture (required for creates; patches the output line on updates) | |
| putAwayRemarks | No | ||
| outputProductId | No | Product ID being manufactured (required for creates) | |
| outputSublocation | No | Sublocation for the output line | |
| deleteInputLineIds | No | manufacturingOrderLineId values to remove from the order during an update. | |
| outputSerialNumbers | No | Serial numbers / serial numbers for the output/finished product. On updates, patches quantity.serialNumbers on the parent output line; pass [] to clear. |