Postman collection
Orderlines Read

pixiCanCancelOrderline2

Returns the status of an order line and a flag that tells whether the order line can still be cancelled.

Checks whether a single order line can be cancelled and returns one row for it.

The order line given in OrderlineKey is read from Orderlines and joined with OrderStates on its status code. The row contains the order line key, the status code, the status text and the flag CanCancel.

CanCancel is 1 only if all of these conditions are true:

  • the status is not a final state (FinalState of the status is N or empty),
  • the status is not EIN,
  • the order line is not referenced in BoxItems (no box item exists for it),
  • the order line is not referenced in InvLines (it has not been invoiced).

In every other case CanCancel is 0.

The call only checks. It does not cancel anything and does not change any data.

Notes

  • All tables are read WITH (NOLOCK). The result can reflect uncommitted changes, so check again right before you cancel.
  • The result set is empty if the order line does not exist or if its status code has no entry in OrderStates (inner join).
  • The checks against BoxItems and InvLines use NOT IN subqueries. If one of these tables contains a row with an empty (NULL) order line reference, the condition is never true and CanCancel is 0 for every order line.

Tables used

Orderlines · Read OrderStates · Read BoxItems · Read InvLines · Read
SQL object:
dbo.pipiCanCancelOrderline2
Updated at 2026-10-30