ERP, Commerce & Customer · 27 June 2025

🧩 Unlocking True Headless B2B Commerce with D365 β€” Without Customizing the Core

Dynamics 365 Commerce has matured into a strong platform for both B2C and B2B scenarios. Yet for organizations aiming to build a headless B2B strategy, there’s a fundamental limitation: the data model is rooted in individual customer accounts. For modern B2B journeys involving multiple organizations and users, this creates real challenges.

At 365Connect, we’ve faced this first-hand. Instead of fighting against the platform, we developed an approach that:

  • ⚑ Works without core customizations to D365 Commerce
  • πŸ“¦ Keeps the standard Commerce APIs fully intact
  • 🌍 Enables modern B2B use cases

🚧 The Core Challenge: Identity vs. Organization

In the out-of-the-box D365 Commerce model, every user is tied to an individual customer account. Transactions are recorded on that account, with the B2B customer only referenced as an invoice account.

This means:

  • Collaboration within the same B2B organization is difficult
  • Transacting on behalf of different legal entities is complex
  • Headless orchestration between frontends and ERP is limited

πŸ’‘ Our Approach

The current person customer/B2B customer data model is a challenge here. I’ve seen heavy customizations in the market to change the model to contact- and B2B organisation-based which hits the core foundation of the Customer context in D365 CSU.

We decided to leverage a creative solution which does not impact core CSU functionality.

The solution capitalizes on having 1 enterprise identity account (=person customer) per B2B organization which is shared across the identities (=B2B users). This 1:N association is realized in the standard RetailExternalIdentityToCustomerMap table.

By developing a custom CSU endpoint (/Commerce/TSFCActivateOrganization) working against the RetailExternalIdentityToCustomerMap, the online shop frontend is in control to bind a logged-in user (identity) to another organization from the online shop’s front end. This is truly headless and unlocks true Order on behalf for B2B organizations where 1 buyer can now work on behalf of multiple organizations (like subsidiaries of the same organization).

One difficult hurdle we faced here was the fact that the customer context is cached for 5 minutes (hard coded in an area which cannot be extended). So, even though the logged-in user had switched to a different organization, the customer context still continued to use the original context for 5 minutes. We resolved this by implementing a request handler for the GetCommerceIdentityByExternalIdentityServiceRequest and override it with our own custom caching.

Upon standard sales transaction to order conversion in D365 ERP, the person customer account is swapped by the actual B2B account (by look up via the Customer Hierarchy) before the order is created.

This end-to-end works very well and covers all beforementioned B2B requirements without hitting any core CSU code. As such, this solution component, together with a few other tweaks, is a game changer for using D365 Commerce CSU in the B2B market.

βœ” Zero custom code in the core βœ” ERP receives clean and correct customer assignments βœ” Headless architecture stays lean and flexible βœ” Works with Microsoft D365 frontends as well as third-party apps


🎯 Why This Matters for B2B Commerce Leaders

As more enterprises embrace composable commerce and API-first architectures, the last thing they want is heavy customization in their core systems.

With our approach, B2B leaders can:

  • πŸ‘₯ Empower employees to place orders on behalf of multiple organizations
  • πŸ›’ Enable collaboration through shared carts
  • πŸ”— Support dealers and partners in B2B2B models
  • πŸ“ˆ Accelerate innovation while keeping upgrade paths safe

🀝 An Open Invitation to Microsoft

We see Microsoft investing heavily in headless, composable, and AI-driven Commerce. Our solution shows that even foundational gaps can be addressed β€” by understanding the platform deeply and applying it creatively rather than customizing it.

We invite Microsoft and partners to join us in scaling this approach, and making D365 Commerce the most adaptable platform for headless B2B commerce in the market.


🧭 Let’s Talk

Are you a B2B commerce leader, Microsoft architect, or ISV struggling with these challenges?

πŸ”— Get in touch via patrickmouwen.com/contact. Happy to help you unlock the full potential of headless B2B Commerce with D365 β€” without unnecessary complexity.

← All writing