Design the integration between Salesforce and an ERP for customers, orders and invoices.
Model answer
First agree ownership: ERP owns customer legal data, orders and invoices; Salesforce owns prospects, opportunities and service interactions.
| Flow | Pattern | Mechanism |
|---|---|---|
| Customer master ERP โ Salesforce | Batch sync (+ near real time for new customers) | Middleware upserts by ERP_Id__c via Bulk API 2.0 nightly; ERP events for urgent changes |
| New customer Salesforce โ ERP | Fire-and-forget + callback | Platform event โ middleware โ ERP; ERP number written back (remote call-in) |
| Price and stock check | Request-reply | Named Credential callout via middleware, 3-second timeout, cached fallback |
| Order submission | Fire-and-forget | Platform event published after commit; status updates back as remote call-in |
| Invoices and payments history | Data virtualization or summary sync | External object for detail; nightly totals on Account |
Cross-cutting: an External Client App with JWT bearer or client credentials for middleware's calls into Salesforce, least-privilege integration user; Named Credentials outbound; idempotency keys and external IDs everywhere; an integration log with correlation IDs; alerting on failures and backlog; and a field-ownership matrix so nobody (including AI agents) writes fields another system owns.
โ Key points to hit
โ Red-flag answers
- Synchronous order creation from the UI
- Copying all invoices into Salesforce by default
- No external IDs
โช Follow-ups
ERP is down for maintenance every Sunday. What changes?
Requests queue in middleware (or events are retained and replayed), the UI shows 'pending' statuses, request-reply lookups fall back to cached values with a timestamp, and no user has to re-key anything.
How do you trace one order across systems?
Carry a correlation ID from Salesforce through middleware into ERP and back, log it at every hop, and show it on the order record so support can search all logs by it.