Postman collection
Orders Write

pixiTagMatchAddForOrders

Assigns one or more tags to orders, passed as XML, and returns a status row for every tag/order pair.

Creates tag assignments (TagMatch entries) between tags and orders.

  1. The XML in TagsXML is parsed element-centric along /Tags/Order/TagList/Tag. Every Tag element becomes one candidate. Its TagId is combined with OrderId and OrderNrExternal from the enclosing Order element. The values 0 and empty strings are treated as missing.
  2. The order is resolved via OrderHeader:
    • OrderId is matched against OrderHeader.OrderNr.
    • OrderNrExternal is matched against OrderHeader.OrderNrExternal.
    • If both are given, the order number (OrderId) takes precedence.
  3. Each candidate is validated:
    • No TagId, or neither an order number nor an external order number: Mandatory parameter is missing.
    • The order cannot be found, or the tag does not exist as an order tag (Tag.TypeId = 2): One of the provided values is not valid.
    • The tag is already assigned to the order: warning Tag is already assigned to that order.
  4. All remaining candidates are inserted into TagMatch (TagId, OrderHeaderId). Duplicate pairs in the XML are written only once.

The call returns one row per processed candidate, in the order of the Tag elements in the XML. Each row carries the status and the message.

Notes

  • The call runs in its own transaction. If it is called inside an existing transaction, it uses a savepoint instead.
  • Lookups on OrderHeader, Tag and TagMatch use NOLOCK.
  • If an unexpected error occurs (for example invalid XML), the CATCH block rolls the transaction back and logs the error via log.InsertError. No result set is returned in that case. The internal message Unexpected error: ... is built but never selected.
  • Only tags with TypeId = 2 (order tags) are accepted.
  • If an OrderNrExternal matches several orders, one candidate can produce several result rows.
  • If TagsXML is omitted (NULL) or contains no Tag elements, nothing is assigned.

Tables used

OrderHeader · Read Tag · Read TagMatch · Write
SQL object:
dbo.pipiTagMatchAddForOrders
Updated at 2026-10-30