Postman collection
Orders Write

pixiCreateOrderComment

Adds a free-text comment to an existing order and records the user and timestamp of its creation.

Creates a new entry in the order comments for the given order.

Steps:

  1. Validation: if OrderNr is missing or 0, or Comment is missing or empty, the call returns an error row and does nothing else.
  2. Order check: the call counts the orders in OrderHeader with the given OrderNr. If there is none, it returns an error row that contains the order number.
  3. Insert: otherwise it inserts one row into OrderComments with the order number, the comment text, the value of User as creating employee (CreateEmp) and the current server time as CreateDate.
  4. It then returns a single row with ReturnCode = SUCCESS.

Each call adds a new comment. Existing comments are never changed or replaced.

Notes

  • The header comment in the code says the procedure gets order comments; this is wrong. The procedure only inserts a comment.
  • The shape of the result row differs: error rows have the columns ReturnCode and ErrorMsg, the success row has only ReturnCode. Clients should check ReturnCode first.
  • No explicit transaction is used. Calling the procedure again creates a duplicate comment, so retries after timeouts can lead to double entries.
  • CreateDate is set with CURRENT_TIMESTAMP, i.e. the local time of the database server.
  • Comment is varchar, not nvarchar; characters outside the database code page may be lost.
  • Because SQL Server ignores trailing spaces in string comparisons, a comment consisting only of spaces is rejected as empty.
  • Values for User longer than 50 characters are truncated by the parameter type.
  • The order is identified only by the internal OrderNr; an external order number is not supported.

Tables used

OrderHeader · Read OrderComments · Write
SQL object:
dbo.pipiCreateOrderComment
Updated at 2026-10-30