Postman collection
Orders Read

pixiCanChangeAddress

Returns 1 if the address of an order may still be changed because no invoice lines exist for its order lines, otherwise 0.

Checks whether the address of an order can still be changed. The check is based only on whether the order has already been invoiced, completely or partially.

  1. If both OrderNr and OrderNrExternal are NULL, the function returns 0 right away.
  2. Otherwise it identifies the order lines (Orderlines) of the order:
    • by OrderNr if only OrderNr is given, or
    • by OrderNrExternal if only OrderNrExternal is given.
  3. It counts the invoice lines (InvLines) that reference one of these order lines through OrderlineRef.
  4. It returns 0 if at least one invoice line exists (the order is invoiced at least partially). It returns 1 if no invoice line exists, which means the address may be changed.

Notes

  • Pass only one of the two parameters. If both are given, neither filter condition applies. No order lines are found, and the function returns 1 (change allowed), even if the order is invoiced.
  • A non-existent order number also returns 1, because no invoice lines are found. The function does not check whether the order exists.
  • Both tables are read with NOLOCK, so the result can reflect uncommitted data.
  • The function only checks for invoice lines. Other states, such as shipped or cancelled orders, are not considered.

Tables used

InvLines · Read Orderlines · Read
SQL object:
dbo.pipiCanChangeAddress
Updated at 2026-10-30