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

W048: Delete customer

Removes a customer if nothing references it. Triggered from Customer Detail. Delete is conservative: any SO or child customer blocks the operation. UI typically routes users to archive instead.

Steps

  1. Load the customer. Call Customers.getCustomerById.

  2. Block if SOs reference it. Call SalesOrders.listSos({ customerId }); refuse if non-empty. Customers are part of every SO's audit trail.

  3. Block if children reference it. Refuse if this customer is the parent of any other customer; deleting would orphan the children.

  4. Delete the row. Call Customers.deleteCustomer.

Returns

Nothing.

Business rules

  • Order history blocks deletion. A customer with any SO cannot be deleted; archive instead.
  • Children block deletion. Re-parent or delete children first.

Errors

  • NotFoundError. The customer was not found.
  • InUseError. SOs or child customers still reference this customer.