Postman collection
Suppliers Write

pixiDispoClearSOrderlinesOnNEW

Deletes all lines and then the empty supplier orders with status NEW that were created by the given user.

Cleans up supplier orders (disposition) that are still in status NEW (StatusId = 1) for one creating user.

  1. Reads the setting LogControl_DoNotDeleteOrderlinesOnNew. If it is 1, the call does nothing.
  2. Resolves @CreateEmp to a user ID using inf.UserGetByName. No fallback user is used.
  3. Deletes all rows in pixi.SupplierOrderLine that belong to supplier orders with StatusId = 1 and RecordCreatedByUserId equal to that user ID.
  4. Deletes the supplier orders with StatusId = 1, created by that user, that no longer have any order lines.

Only orders created by the given user are affected. Orders of other users and orders in any other status stay unchanged. The call returns no result set.

Notes

  • If @CreateEmp does not exist in UCS_USERS, the user ID is NULL and nothing is deleted. The call gives no feedback in this case.
  • If the setting LogControl_DoNotDeleteOrderlinesOnNew does not exist, it counts as 0, so the deletion runs.
  • Both DELETE statements run without an explicit transaction. The subqueries read with NOLOCK.
  • The orders are deleted with a NOT IN check against all SupplierOrderId values of pixi.SupplierOrderLine. If any line has a NULL SupplierOrderId, no order is deleted.
  • An earlier deletion of history rows (SOrderlinesHist) is commented out and does not run.
  • The deletion is permanent. The call returns no rows and no row counts.

Tables used

SupplierOrderLine · Write supplierOrder · Write Settings · Read UCS_USERS · Read
SQL object:
dbo.pipiDispoClearSOrderlinesOnNEW
Updated at 2026-10-30