Postman collection
Orders Write

pixiChangeAddress

Changes the billing or shipping address of an order, as long as the order has not been invoiced yet.

Updates the address record that is linked to an order and returns a status text.

  1. The order is identified either by OrderNr or by OrderNrExternal. OrderNr = 0 and an empty OrderNrExternal are treated as not set.
  2. The function pipiCanChangeAddress checks whether the address may be changed. It returns 0 if no order is given or if any order line of the order already has an invoice line (InvLines). Otherwise it returns 1.
  3. The address key is read from the order lines (Orderlines):
    • If AddrType contains B (not case-sensitive), the billing address (AddrRef) is used.
    • Otherwise the shipping address (ShipAdrRef) is used. This also applies to S, other values and an empty value.
  4. If changing is allowed and an address was found, the address is updated:
    • Empty strings are treated as "not passed". Every parameter that is not passed keeps the current value of the address. Only the fields that are passed are changed.
    • ASlocked sets the shipping lock: 1 sets ASlocked = 'Y', any other numeric value sets 'N'. If it is omitted, the current value is kept.
    • For shipping addresses (AddrType = 'S' in Addresses), a row is written to pixi.AddressesShippingLockHistory when the lock state changes.
    • UpdateDate is set to the current date and UpdateEmp to api.
  5. The status is returned in the output parameter FunctionResult and as a single row with the column Result.

Notes

  • Pass only one order identifier. If both OrderNr and OrderNrExternal are passed, no order line matches. The result is then 402 Address not found.
  • Fields cannot be cleared. Empty values are ignored and the existing value is kept. The exception is CareOf: an empty string is written as an empty string.
  • ASlocked must be numeric. The code compares it with the number 1. A value such as Y therefore causes an SQL conversion error, which is returned as SqlMessage. Use 1 or 0.
  • Lock history. The history row is only written if the stored ASlocked value differs from the new value. If the stored value is NULL, no history row is written. The user ID for the history is the user api, or pixiAdministration as a fallback.
  • Orders with several lines. The address key is taken from one of the order lines; the code does not determine which one. Orders whose lines reference different addresses are not handled specifically.
  • Reads and transactions. Order lines and addresses are read with NOLOCK. There is no explicit transaction.
  • Status codes. The codes 200–403 are plain text codes and not HTTP statuses. If neither changing is allowed nor an address is found, 402 overrides 401.

Tables used

Orderlines · Read InvLines · Read Addresses · Write AddressesShippingLockHistory · Write UCS_USERS · Read
SQL object:
dbo.pipiChangeAddress
Updated at 2026-10-30