Postman collection
Suppliers Write

pixiCreateSupplier

Creates a new supplier together with its main contact and returns a status row with ReturnCode and Message.

Creates one new supplier record in Suppliers and one main contact record in pixi.Contact, linked via ContactId.

Steps:

  1. Every string parameter passed as an empty string is treated as NULL. SupplCtry is trimmed first.
  2. If CurrencyId is not passed, the database currency is used. This is the currency from the HomeCurrency setting, read via pixi.GetDatabaseCurrency.
  3. CanDoDirectFulfillment is converted to a bit: Y becomes 1. N and any other value become 0.
  4. Validation runs in this order and stops at the first error:
    • SupplNr must be given.
    • SupplName must be given.
    • CanDoDirectFulfillment must not be NULL.
    • No supplier with the same SupplNr may already exist.
  5. If all checks pass, a contact row is inserted. Contact fields that are not passed are stored as empty strings. The supplier is then inserted with:
    • ContactId set to the new contact's identity
    • CreateDate set to the current time
    • CreateEmp set to API
    • MailBox set to eMail
    • SupplComment set to SupplierComment

The call always returns exactly one status row. ReturnCode is OK on success and Error on a validation error or an unexpected SQL error.

Notes

  • Everything runs in the named transaction CreateSupplier. On an SQL error the transaction is rolled back and ErrorMessage contains the SQL error text. Validation errors are not SQL errors: the transaction is committed, but nothing has been written.
  • The duplicate check on SupplNr uses NOLOCK. Two parallel calls with the same number can therefore both pass the check. In that case a unique constraint on the table, if one exists, would produce the generic error.
  • RowsAffected is never updated and is always 0.
  • DefaultDeliveryDays is compared to an empty string. As an int, the value 0 is therefore stored as NULL.
  • An empty string for CanDoDirectFulfillment passes the mandatory check and is stored as 0.
  • SupplGroup, SupplCtry and CurrencyId are not validated against master data.
  • If no database currency can be determined, CurrencyId stays NULL.
  • A contact row is always created, even if no MainContact_* parameter is passed.
  • Values longer than the declared parameter length (e.g. SupplNr with more than 4 characters) may be truncated silently.

Tables used

Suppliers · Write Contact · Write Settings · Read Currency · Read
SQL object:
dbo.pipiCreateSupplier
Updated at 2026-10-30