Postman collection
Customers Read

pixiCustomerKeyByEmail

Returns the customer key (`CustKey`) of the customer in a given shop whose primary or secondary e-mail address matches the given address.

Looks up a customer by e-mail address within one shop and returns its internal key as a single integer value.

  • A customer matches if @eMail equals either the eMail or the eMail2 field and the customer belongs to the shop @ShopId (CustomerOf).
  • Only customers that have at least one address record (Addresses.AdrCustRef = CustKey) can be returned, because the lookup uses an inner join on the addresses.
  • With @AllowAmbiguous = 0 (default) a key is returned only if exactly one customer in the shop has this e-mail address. If several customers share the address, the result is NULL.
  • With @AllowAmbiguous = 1 the uniqueness check is skipped and the key of one of the matching customers is returned.
  • If no customer matches, the result is NULL.

Notes

  • All reads use NOLOCK, so uncommitted data may be seen.
  • When @AllowAmbiguous = 1 and several customers match, the choice is made with TOP 1 without ORDER BY; which customer is returned is not deterministic.
  • The uniqueness count only considers the Customers table, not the address join. A single matching customer without any address therefore yields NULL.
  • NULL is returned both for "not found" and for "ambiguous"; the caller cannot distinguish these cases from the result alone. Call again with AllowAmbiguous = 1 to check whether matches exist.
  • Whether the comparison is case-sensitive depends on the database collation; no trimming or normalisation of the e-mail address is done.

Tables used

Customers · Read Addresses · Read
SQL object:
dbo.pipiCustomerKeyByEmail
Updated at 2026-10-30