ml-connector
Microsoft Dynamics 365 F&OIBM Sterling

Microsoft Dynamics 365 F&O and IBM Sterling integration

Microsoft Dynamics 365 F&O is the system of record for orders, invoices, and the general ledger. IBM Sterling is the EDI gateway that exchanges those documents with trading partners over AS2, SFTP, and VANs. Connecting the two means a confirmed purchase order or a posted invoice in Dynamics turns into an outbound EDI document in Sterling without manual file handling, and an inbound order or remittance that arrives in a Sterling mailbox becomes a Dynamics record. ml-connector handles the very different APIs on each side, since Sterling is EDI middleware and not an ERP, and moves documents on a schedule you control.

How Microsoft Dynamics 365 F&O works

Microsoft Dynamics 365 F&O exposes vendors, purchase orders, sales orders, vendor and customer invoices, payment journal lines, and GL accounts through an OData v4 REST service at a tenant-specific operations.dynamics.com host. It authenticates with OAuth 2.0 client credentials issued by Microsoft Entra ID, using a scope tied to that environment host, and bearer tokens last about an hour. Reads page with server-driven paging and an @odata.nextLink, capped at 10,000 records, and entity keys must be fully qualified including dataAreaId. Dynamics can push Business Events over HTTPS when a document is posted, but those payloads are lightweight stubs identified by a ControlNumber, so the connector calls OData back for full record detail.

How IBM Sterling works

IBM Sterling B2B Integrator is an on-premises EDI platform whose REST API at /B2BAPIs/svc/ manages trading partners, mailboxes, mailbox messages, documents, and workflows rather than storing invoices or orders as first-class records. It authenticates with HTTP Basic over HTTPS using a dedicated non-super-user account, or with OAuth 2.0 on version 6.2.2 and later, against a customer-specific host and Liberty port. The REST layer is JSON only and has no outbound webhooks, so new EDI documents are discovered by polling mailbox messages. Finance and procurement transactions move as X12 or EDIFACT payloads inside the platform: 850 orders, 810 invoices, 856 ship notices, and 820 remittance, not as queryable REST fields.

What moves between them

Documents move in both directions. Outbound, ml-connector reads confirmed purchase orders, posted vendor and customer invoices, and ship notices from the Dynamics 365 F&O OData entities and writes them into IBM Sterling as 850, 810, and 856 EDI documents placed in the right partner mailbox. Inbound, it polls Sterling mailboxes for 850 purchase orders sent by buyers and 820 remittance advice, then writes them into Dynamics as sales orders and vendor payment journal lines. Trading partner and item references are aligned on both sides so each document resolves to a real Dynamics vendor, customer, or product. Cadence follows your schedule, typically a few minutes for inbound polling and event-triggered or scheduled runs outbound.

How ml-connector handles it

ml-connector stores both credential sets encrypted. On the Dynamics side it requests an Entra ID client-credentials token scoped to the environment host, refreshes it before the one-hour expiry, accepts the tenant-specific host as a credential field since there is no shared base URL, and adds cross-company filtering when more than one legal entity is in play. On the Sterling side it sends HTTP Basic with a dedicated non-super-user account, or OAuth on 6.2.2 and later, against the customer host and Liberty port. To inject an outbound document it first POSTs the EDI payload to /documents/ to get a documentId, then creates a mailbox message referencing it, because Sterling does not let you inline content in the message. Inbound, since the REST layer has no webhooks, it polls mailbox messages on a schedule and extracts new payloads by createdDate cursor. Neither side offers an idempotency key, so Dynamics natural keys such as InvoiceNumber and Sterling messageId are used with a BullMQ jobId to dedupe, and posted Dynamics invoices are read-only so they are never updated after the fact. Failed posts get automatic retries, a full audit trail, and error replay.

A real-world example

A mid-sized consumer goods manufacturer of about 600 staff runs Microsoft Dynamics 365 F&O for procurement, sales, and finance, and is required by its large retail customers to trade orders and invoices over EDI through IBM Sterling. Before the integration, a coordinator exported confirmed POs and posted invoices from Dynamics, hand-built the EDI files, and dropped them into Sterling mailboxes, while inbound retailer orders were re-keyed into Dynamics by hand. Orders sat for hours, invoice numbers were occasionally mistyped, and chargebacks from late or malformed documents were a recurring cost. With the two systems connected, posted invoices and confirmed POs flow into Sterling as 810 and 850 documents automatically, inbound 850 orders become Dynamics sales orders within the polling window, and the manual file handling and re-keying are gone.

What you can do

  • Write confirmed Dynamics 365 F&O purchase orders and posted invoices into IBM Sterling mailboxes as outbound 850, 810, and 856 EDI documents.
  • Poll IBM Sterling mailboxes for inbound 850 orders and 820 remittance and create matching Dynamics sales orders and payment journal lines.
  • Map trading partner identifiers to Dynamics vendor and customer accounts so each EDI document resolves to a real record.
  • Bridge Microsoft Entra ID OAuth client credentials on the Dynamics side with Sterling HTTP Basic or OAuth on the customer host and Liberty port.
  • Dedupe on Dynamics natural keys and Sterling message ids with retries and a full audit trail on every document.

Questions

Which direction does data move between Microsoft Dynamics 365 F&O and IBM Sterling?
Documents move both ways. Confirmed purchase orders, posted invoices, and ship notices flow from Dynamics into Sterling as outbound 850, 810, and 856 EDI documents, while inbound 850 orders and 820 remittance arriving in Sterling mailboxes are written back into Dynamics as sales orders and payment journal lines. Trading partner and item references are aligned on both sides so every document maps to a real Dynamics record.
Does IBM Sterling push new documents, or does ml-connector poll for them?
ml-connector polls. The Sterling B2B Integrator REST API at /B2BAPIs/svc/ has no outbound webhooks, so new mailbox messages are discovered by polling on a schedule, typically every one to five minutes, and extracted by a createdDate cursor. On the Dynamics side, Business Events can trigger an outbound run when a document is posted, but the connector still calls OData back for the full record because the event payload is only a lightweight stub.
How does the integration handle authentication across the two systems?
It bridges two different schemes. Dynamics uses OAuth 2.0 client credentials from Microsoft Entra ID, scoped to the tenant-specific environment host, with bearer tokens refreshed before their roughly one-hour expiry. Sterling uses HTTP Basic over HTTPS with a dedicated non-super-user account, or OAuth 2.0 on version 6.2.2 and later, against the customer host and Liberty port. Both credential sets are stored encrypted and the correct one is presented on every call.

Related integrations

Connect Microsoft Dynamics 365 F&O and IBM Sterling

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started