Wiki · WO master » Path 1 · R593

NS work order — Path 1 · from sales order

One or more SO lines require assembly. WO is created FROM the SO so records stay linked end-to-end. Production runs, Assembly Build entered, FG added to inventory at correct location, then SO is fulfilled. Item Fulfillment fires the ★ automation alert to Finance.

PATH 1 · from sales order WO PO# field TBD
What this is

WO created FROM Sales Order

Path 1 covers the case where one or more lines on a customer SO require assembly. A Work Order is created FROM the SO (workorder.createdfrom = so.id) preserving the SO ↔ WO link end-to-end. Components are reviewed at the correct location, production runs, the Assembly Build is entered in NetSuite (Mike approves at /assembly-build.html), finished goods are added to inventory, then the SO is fulfilled. Item Fulfillment fires the ★ automation alert to Finance; Finance reviews, invoices, monitors terms, applies payment, and closes the order.

Shortcut: if the FG is already on hand at the correct location, fulfill the SO from inventory and close the WO marked unused.

Diagram: ns-work-order-path-1-from-sales-order.html. Master wiki: wiki-ns-work-order-master.html. Other path: Path 2 inventory build. Workflow contract: wo_lifecycle_from_sales_order_path (risk 3).

When to use it

Trigger

★ The handoff

Item Fulfillment closes → events.wo.finance_alert_fired emits → Finance picks up review. Same handoff signal as the SO master.

WO PO# field — TBD pending Mike review

Expected pattern: bodyFields.memo threaded from SO.otherrefnum. Every WO Schema reference flagged TBD until confirmed.

Worked example

Driscoll Melt Mates kit

Driscoll SO #1217 · assembly_line MELT-MATES-KIT-A qty 24

Friday morning. Driscoll SO #1217 (otherrefnum "72622") includes 1 assembly line for Melt Mates kit qty 24. Operator dispatches Path 1; WO-4471 created with createdfrom = 1217 and memo (TBD, expected "72622"). Component review at location 3 (Heartland): CHED-2LB, PRTZL-BAG, TURKEY-PAK on hand. Production runs; crew completes build with 0 waste. Mike approves at /assembly-build.html; NS posts AB-1881 (createdfrom = 4471, quantity = 24, location = 3). FG credited: inventory_balance.quantityavailable += 24 for MELT-MATES-KIT-A at location 3. WO close: status='Built'. SO fulfilled: IF-2210 (createdfrom = 1217, otherrefnum "72622"). ★ Automation alert fires. Finance posts CINV-9032 for $18,420 Net 30; payment received + applied; SO closed.

Step-by-step

From SO assembly-line to WO close (8 stages)

  1. SO assembly-line detected — intake operator (or auto-classifier) flags a SO line where the item is an Assembly Item. Path 1 dispatched.
  2. WO createdWorkOrd record: createdfrom = so.id, assemblyitem = SO-line item, quantity = SO-line qty, memo (TBD = SO.otherrefnum). HITL gate: WO creation through proposed_actions per ADR-031.
  3. Component review — BOM lookup against inventoryitemlocations at WO.location. If shortage: hold + escalate (see Failure modes). If OK: advance.
  4. Production runs — crew completes assembly on the floor. Waste, labor hours, line time captured manually (kiosk/scanner is STUB).
  5. Assembly Build approval — Mike reviews at /assembly-build.html; HITL via proposed_actions. On approve, NS posts AsmBuild: createdfrom = wo.id, item, quantity, custbody_waste (TBD), location, trandate.
  6. Component issueWkOrdIss rows created per BOM component (createdfrom = wo.id). Inventory decrements at component level.
  7. FG creditinventory_balance.quantityavailable += quantity at WO.location for the finished assembly item.
  8. WO closed + SO fulfilledWO.status = 'Built'. ItemFulfill created against SO (NOT WO): createdfrom = so.id, otherrefnum inherits from SO. ★ Universal Finance handoff fires (planned R594 automation).
Outcomes

What is true after Path 1 completes

Failure modes

What can go wrong + recovery

FailureDetectionRecovery
BOM component shortageStep 3 inventory check failsHold WO · escalate to purchasing (stage emergency PO via Path 1 of PO process) · resume when components received
Build short (yield variance > 5%)AsmBuild quantity < WO quantity × 0.95Variance audit fires · HITL review · either accept short fulfillment + adjust SO line, OR re-run build for remainder
Build over (waste < expected)AsmBuild quantity > WO quantityExcess FG goes to inventory (not back to SO) · available for future SOs
WO cancel mid-buildSO cancelled before AsmBuild postsReverse WkOrdIss issues (components back to inventory) · void WO · do not post AsmBuild
AsmBuild void after postBad build, defective FGVoid AsmBuild · re-issue components · rebuild · re-link IF to corrected build
IF posts before AsmBuildOrder-of-events bugInvariant violation — alert. IF should only post after AsmBuild credits FG.
Customer cancels SO after IFSO status = 'Cancelled' with IF.status = 'Shipped'RMA / Return Authorization workflow · receive returned goods · restock or scrap · Credit Memo
Finance alert fails to fireIF.status = 'Shipped' but no CustInvc within 1 hourManual Finance handoff · investigate NS workflow trigger · check ns_pending_pushes
Related

Adjacent flows + diagrams

For developers

Code paths + invariants

ConcernWhere
Linkage invariantworkorder.createdfrom = so.id
Assembly Build linkageassemblybuild.createdfrom = wo.id
Item Fulfillment linkageitemfulfillment.createdfrom = so.id (NOT wo.id)
FG creditinventory_balance.quantityavailable += quantity at location_id
HITL gate/assembly-build.html → proposed_actions → Mike approves
Finance alert (STUB)events.wo.finance_alert_fired on IF.status='Shipped'
WO PO# field (TBD)bodyFields.memo (expected) = SO.otherrefnum
Changelog

Dated trail

DateRoundChangeTouched by
2026-05-26R593Path 1 wiki created as part of WO master split (matches R592 SO pattern). Split into master + 2 path-details. Mike + Claude.Mike + Claude
Schema · data contract

Path 1 sub-contract spec

Sub-contract: wo_lifecycle_from_sales_order_path · risk 3 · dispatched by WO master when origin = from_sales_order.

Path 1 NS records (field-level)

NS recordKey fieldsSample valuesStatus
SalesOrd (upstream)tranid, otherrefnum"1217", "72622"REAL
WorkOrdtranid, createdfrom, assemblyitem, quantity, location"WO-4471", 1217, "MELT-MATES-KIT-A", 24, 3REAL
WorkOrdbodyFields.memo — customer PO# fieldTBD — expected "72622"TBD — Mike review pending
AsmBuildtranid, createdfrom, quantity, custbody_waste, location"AB-1881", 4471, 24, 0, 3REAL
ItemFulfilltranid, createdfrom, otherrefnum, status"IF-2210", 1217 (SO id), "72622", "Shipped"REAL
CustInvctranid, otherrefnum, amount"CINV-9032", "72622", 18420.00REAL
CustPymttranid, appliedto"CPYMT-3120", "CINV-9032"REAL

Path 1 verify_checks

namewindowexpected
wo_linked_to_so60 minwork_orders.createdfrom = so_id
assembly_build_posted2880 minassembly_builds.wo_id has ≥1 row
fg_credited2880 mininventory_balance.quantityavailable increased by build qty at location_id
if_created_from_so2880 minitem_fulfillments.createdfrom = so.id
finance_alert_fired2880 minevents.wo.finance_alert_fired exists for IF (STUB today)
wo_memo_carries_po · TBD2880 minTBD — Mike review pending; expected WO.memo = SO.otherrefnum once confirmed
so_closed43200 mintransactions.status = 'Closed'
Runbook

When Path 1 breaks

Assembly Build done but SO never fulfilled

  1. Verify the link: SELECT id, createdfrom, status FROM work_orders WHERE id=?
  2. If createdfrom is NULL: patch with UPDATE work_orders SET createdfrom=? WHERE id=?
  3. Force resync: POST /api/sync/run?tier=hot&table=transactions&id=<so_id>
  4. Trigger fulfillment manually in NS: from the SO, hit "Fulfill" with the assembly on hand

WO PO# field threading break (pending Mike)

  1. Confirm with Mike: which WO body field carries customer PO#? Expected bodyFields.memo
  2. Until confirmed: trace via createdfrom = so.id linkage only
  3. Schema fix post-confirmation: add WO.memo == SO.otherrefnum verify_check
Backlog

Open questions for Path 1