We are building a B2B company-to-customer mapping strategy for the Shopify Connector. Our Danish wholesale customers place orders through Shopify B2B, where each company has a Tax Registration Id (CVR number) on their company location. We
need to match incoming Shopify companies to existing BC customers by this Tax Registration Id, with a fallback to email and phone matching.
The Tax Registration Id is the primary matching key for standard B2B wholesale companies. However, the email/phone fallback is essential for two additional business scenarios:
High-value private customers. Private individuals who generate significant revenue can be created as Shopify B2B companies to give them access to dedicated price catalogues. These "companies" represent individuals, not businesses, so their
locations have no Tax Registration Id. Matching must fall back to the contact's email address to find the corresponding BC customer.
Employee personal purchases. Employees of B2B companies can be added as separate locations on their employer's Shopify company, allowing them to purchase products for private consumption through the company's B2B storefront. These employee
locations should map to a different BC customer than the company itself — the employee's personal account rather than the employer. Since employee locations carry no Tax Registration Id, matching falls back to the location contact's email to
find the correct individual BC customer.
The combined strategy — Tax Id first, then email/phone fallback — handles all three scenarios through a single mapping implementation: standard B2B wholesale (by CVR number), VIP private customers (by email), and employee personal orders (by
email to a separate customer).
The Shopify Connector's extensible Shpfy Company Mapping enum (30151) correctly allows us to add a custom mapping implementation via ICompany Mapping. The interface works well for the matching logic itself.
The problem is data availability. When DoMapping is called during order import, the Shpfy Company Location record — which holds the Tax Registration Id we need for matching — has not yet been fetched from Shopify. The connector fetches
company location data after mapping runs. To work around this, we had to build a complete standalone Shopify Admin API integration (OAuth client credentials flow, GraphQL client, request/response logging, setup UI) — 5 additional objects —
solely to fetch data that the connector already knows how to fetch, just at the wrong time.
---
Extensibility Requests
A. Make Shpfy Company API (CU 30286) accessible to extensions
The Shpfy Company API codeunit already has the exact procedures we need:
- RetrieveShopifyCompany — fetches company data from Shopify
- UpdateShopifyCompanyLocations — fetches all locations (including Tax Registration Id)
These are currently Access = Internal. Making them accessible would let our DoMapping implementation call the connector's own data-fetching logic before performing the match. The procedures themselves remain sealed — extensions can only
trigger the fetch, not modify the queries, parsing, or data handling. This is low-risk because it's equivalent to the connector calling these same procedures itself, just at a different point in the flow.
This single change would eliminate 5 of our 8 custom objects (the entire API client, credentials table, setup page, log table, and log page).
B. Create a Shpfy Company Events codeunit
The connector provides Shpfy Customer Events (CU 30115) with events like OnBeforeFindMapping and OnBeforeCreateCustomer for the customer mapping path. No equivalent exists for the company mapping path. Adding events such as:
- OnBeforeCompanyFindMapping — lets extensions ensure required data is available before matching runs
- OnBeforeCreateCompanyCustomer / OnAfterCreateCompanyCustomer — lets extensions customize customer creation from company data
This would bring company mapping to parity with customer mapping in terms of extensibility.
C. Populate Company Location data before DoMapping runs
During order import, the current sequence is:
1. MapCompany → calls DoMapping via ICompany Mapping
2. MapLocationCode → fetches and populates Shpfy Company Location records
If step 2 ran before step 1, the Tax Registration Id would already be available in the database when DoMapping executes. Any ICompany Mapping implementation could then match by Tax Registration Id without needing to make its own API calls.
This is the most fundamental fix — it aligns data availability with the point where the data is needed.
