Postman collection
General Write

pixiTagMatchAdd

Assigns an existing tag to an item or an order, depending on the tag type, and returns a status row.

Creates a tag assignment (a row in TagMatch) for the tag given in TagId.

Steps:

  1. Reads the type of the tag from Tag. The type decides which object the tag can be assigned to:
    • TypeId = 1: item tag, ItemId is required and must exist as ItemKey in items.
    • TypeId = 2: order tag, OrderNr is required and must exist as OrderNr in OrderHeader. The order number is translated to the internal OrderHeaderKey.
  2. Checks whether the tag is already assigned to the given item or order.
  3. Validates in this order and stops at the first failure: missing TagId, unknown tag, missing ItemId/OrderNr for the tag type, unknown item/order, existing assignment.
  4. If all checks pass, inserts the assignment. For an item tag only the item is stored, for an order tag only the order header key is stored; the other parameter is ignored.

The call always returns one row with Status (Success, Warning or Error) and Message.

Notes

  • The work runs in its own transaction, or in a savepoint if the caller already has an open transaction. On an unexpected error the changes are rolled back, the error is logged via log.InsertError and a status row with Unexpected error: "…" (first 80 characters of the SQL error) is returned instead of a SqlMessage.
  • Lookups use NOLOCK, so the duplicate check can read uncommitted data; two concurrent calls could both pass the check.
  • The duplicate check matches the tag against the order or the item. If both OrderNr and ItemId are sent, an existing assignment to either one leads to the Warning, even if it does not belong to the tag type.
  • For tags whose TypeId is neither 1 nor 2 no item/order validation takes place and a TagMatch row with both ItemId and OrderHeaderId empty is inserted.
  • OrderNr is the visible order number, not the internal OrderHeaderKey; ItemId is the internal ItemKey.
  • The header comment of the procedure ("Get tags for objects") does not match its behaviour; the procedure writes data.

Tables used

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