Postman collection
Customers Write

pixiUpdateCustomer

Updates the e-mail, name and postal address of an existing customer and its linked address, saving the previous address to the address history.

Updates a customer identified by CustKey together with the address linked to it through Customers.AddrRef.

  1. All text parameters are trimmed. Empty strings are treated as NULL.
  2. The customer is looked up by CustKey, joined to its address. The customer must have a linked address.
    • No match: status 404.
    • More than one match: status 409.
  3. If exactly one customer is found, the following steps run in one transaction:
    • The current address is copied to the address history. HUpdateEmp is set to API and HNoteHist to Duplicate Check App.
    • The customer's e-mail (Customers.CeMail) is set to eMail. This is always done, even if eMail is NULL.
    • The address is updated. Only parameters that are not NULL change the stored value:
      • FirstName, LastName, Street, HouseNr, City, ZIP and eMail are updated individually.
      • Name is rebuilt as first name + space + last name.
      • Address is rebuilt as street + space + house number.
    • The call returns status 200.
  4. Any SQL error rolls back the transaction and returns status 500 with the SQL error text.

The call always returns exactly one status row with StatusCode and ErrorMsg. ErrorMsg also holds the success message.

Notes

  • Pitfall – customer e-mail is cleared: Customers.CeMail is overwritten with eMail without a NULL check. Leaving out eMail, or passing an empty value, clears the customer's e-mail. Only the address e-mail (Addresses.eMail) keeps its old value. Always pass the current e-mail if it must not change.
  • Pitfall – rebuilt fields: Name and Address are always rebuilt from first/last name and street/house number. The rebuild uses the parameters, or the stored column values if a parameter is NULL. If one of the two parts is NULL in both the parameter and the stored column, the result is usually NULL (standard CONCAT_NULL_YIELDS_NULL behaviour). A manually maintained value in Name or Address is overwritten.
  • Not written to history: the history row stores only the classic address fields (for example Name, Address, City, ZIP). FirstName, LastName, Street, HouseNr and eMail are not saved there.
  • Context info: during the address update the session CONTEXT_INFO is set to 0x33999 and reset to 0x00000 afterwards. Its purpose is not visible in the code; it is probably evaluated by triggers on Addresses.
  • Locking: the lookup reads with NOLOCK. The updates use ROWLOCK inside the named transaction UpdateCustomer.
  • Error handling: the CATCH block always issues ROLLBACK TRANSACTION. If an error occurs before the transaction has started, this rollback may raise an additional SQL error, which arrives as a SqlMessage alongside the 500 status row.
  • Cleanup: the temporary table is dropped via util.TempTableDrop. Its definition is not attached.
  • NULL key: if CustKey is NULL, status 404 is returned and ErrorMsg is NULL.

Tables used

Customers · Write Addresses · Write AddressesHist · Write
SQL object:
dbo.pipiUpdateCustomer
Updated at 2026-10-30