Skip to main content
Version: v1.0.0(int)

W069: Delete material

Removes a material if nothing references it. Triggered from Material Detail. PO items, BOM input rows, and the materials ledger all block deletion. Archiving via PATCH isActive=false (W068) is the routine path.

Steps

  1. Load the material. Call Materials.getMaterialById.

  2. Run in-use checks. PO items via PurchaseOrders.listAllItems({ materialId }), BOM input rows referencing this material, and materials ledger entries.

  3. Refuse if any reference exists. Return per-domain counts in the error payload.

  4. Delete the material. Call Materials.deleteMaterial.

Returns

Nothing.

Business rules

  • Archive is the routine path. Hard delete is reserved for materials that exist by mistake and never moved.

Errors

  • NotFoundError. The material was not found.
  • InUseError. The material is referenced by one or more downstream domains.