Industry
Equipment Sales & Agriculture
Region
Australia
Client Type
SMB — Equipment Manufacturer
Order Volume
Australian Closed Won Opps
Platform
Salesforce CPQ + MYOB Advance
Delivery
Integration Build — Apex
1-Click
Full order sync — customer, sales order, and invoice created in MYOB Advance with a single button click on any Closed Won opportunity
0
Manual re-keying of order data between Salesforce and MYOB Advance — all quote line items map automatically
100%
Idempotent sync — re-running the process updates existing records rather than duplicating orders or customers
Real-time
Invoice records appear back in Salesforce immediately after MYOB Advance confirms the sales order — no lag, no chasing
Full
Error visibility — every sync attempt logs success or failure with detail directly on the Salesforce Opportunity record
Secure
OAuth 2.0 token auth via Named Credential — no hardcoded API endpoints or credentials anywhere in the codebase

Challenge vs. Solution

Six Integration Gaps That Blocked Seamless Order Fulfilment — and Six Fixes That Resolved Them

✕ Before — The Challenges 6 Problems
Manual order re-entry after every close — the sales team had to duplicate every Closed Won deal from Salesforce into MYOB Advance by hand, introducing delays and mistakes at the point of fulfillment.
Duplicate customer records across systems — without a lookup mechanism, every sync risked creating a second MYOB customer card for the same account already in Salesforce.
Quote line items typed in twice — product codes, quantities, and customer prices from Salesforce CPQ quotes had to be manually mapped to MYOB order lines, a task prone to transcription errors.
No invoice visibility in Salesforce — once an order moved into MYOB Advance, the sales team lost sight of invoice status; they had to log into a separate system to check progress.
No error tracking on failed syncs — when data entry mistakes occurred there was no structured record of what went wrong or which order was affected, making audits difficult.
API credentials stored insecurely — MYOB Advance connection details were scattered across configuration files rather than held in a managed, auditable credential store.
✓ After — What We Built 6 Fixes
One-click 'Sync Order to MYOB Advance' button — we built the MyobAdvanceSingleOppSyncOrder orchestrator class that validates eligibility, syncs the customer, and creates the sales order in a single triggered action.
Customer upsert with MYOB card ID lookup — we implemented upsertCardType() which checks MYOB by MYOB_Card_ID__c and creates a new customer only when one doesn't exist, storing the returned UID back on the Salesforce Account.
Automatic CPQ-to-MYOB order line mapping — quote line items flow directly into MYOB sales order lines using SBQQ__Quantity__c, SBQQ__CustomerPrice__c, and the MYOB product UID without any manual entry.
Invoice record created in Salesforce after MYOB confirmation — once the sales order is confirmed in MYOB, getMyobAdvanceInv() fetches the invoice and creates an Invoice__c record immediately, giving the sales team full visibility without leaving Salesforce.
Sync status and error message fields on every OpportunityMYOB_Advance_Sync_Status__c and MYOB_Advance_Sync_Message__c log the outcome of every attempt so failures are visible, traceable, and actionable directly in the CRM.
Named Credential + Custom Settings for secure API management — MYOB's endpoint lives in a Named Credential; OAuth tokens are stored in separated Custom Settings objects, keeping all credentials out of code and in Salesforce's managed secret store.

What We Did

Five Phases That Took From Manual Double-Entry to Automated One-Click Sync

Discovery

Mapped the Full Order Journey Before Writing a Line of Apex

We traced every data point from a Salesforce CPQ quote to a completed MYOB Advance sales order — identifying exactly which fields needed to map, which validations were required, and which failure modes had to be handled. This included confirming that Australian-only scope (AFQ_Company__c = 'Australia') was the correct business boundary before any integration logic was written.

Process Mapping Data Model Review Salesforce CPQ MYOB Advance REST API Gap Analysis
Architecture

Built a Two-Class Apex Architecture — API Layer Separate from Orchestration

We separated concerns cleanly: MYOBAdvanceAPI handles all HTTP communication (auth, requests, retries, 120s timeout) while MyobAdvanceSingleOppSyncOrder owns the business logic — validation, sequencing, and Salesforce record updates. This separation makes each class independently testable and means future changes to the MYOB API surface don't require changes to business logic.

Salesforce Apex Named Credentials Custom Settings OAuth 2.0 JSON-to-Apex Classes
Integration Build

Implemented Customer Upsert, Sales Order Creation, and Salesperson UID Caching

We built the full sync sequence: check or create the MYOB customer via upsertCardType(), look up the salesperson UID by name in MYOB and cache it on the Salesforce User record to avoid repeat queries, then create the sales order using a PUT operation so re-running sync updates rather than duplicates. All quote line items from the accepted Salesforce CPQ quote map automatically using stored product UIDs.

MYOB Advance REST API Salesforce CPQ PUT (Idempotent) Sync SBQQ__Quote__c Account & User UID Caching
Invoice Feedback Loop

Closed the Loop — MYOB Invoice Written Back to Salesforce Automatically

After MYOB Advance confirms the order, we call getMyobAdvanceInv() to retrieve the generated invoice and create an Invoice__c record in Salesforce. The Opportunity's sync status field is immediately updated to 'Success' or 'Failed' with a message — giving the sales and finance teams a shared, real-time view of where every order stands.

Invoice__c Object MYOB_Advance_Sync_Status__c Error Logging Opportunity Update
Hardening

Secured Credentials, Enforced Validation Gates, and Added Batch Error Resilience

We locked down all API credentials into Named Credentials and Custom Settings objects (client ID, secret, tokens — all separated from code), added pre-flight validation checks (Closed Won + accepted Quote + not already synced), and implemented try-catch-continue error handling so that a failure on one opportunity doesn't block others in any future batch processing scenario. Coverage runs from Australian-region filtering through to full HTTP retry logic.

Named Credentials Custom Settings Apex Try-Catch Pre-flight Validation OAuth Token Management

The team was re-entering every closed deal from Salesforce into MYOB manually — slow, error-prone, and not scalable as order volume grew. Now the click happens once, and both systems are in sync. The finance team sees the invoice in MYOB; the sales team sees it in Salesforce. No phone calls, no chasing.

— Twopir Integration Team Lead · Australian Equipment Sales Business · Salesforce + MYOB Advance Project · 2024

Key Outcomes

What Changed — In Numbers and in Practice

1 Click

Complete order sync — customer, sales order, and invoice handled end-to-end

Clicking 'Sync Order to MYOB Advance' on a Closed Won opportunity triggers the full sequence automatically — no manual steps, no system switching.

Zero

Manual re-entry of order data between Salesforce and MYOB Advance

All CPQ quote line items — product codes, quantities, customer prices — map directly to MYOB sales order lines without human intervention.

No Dupes

Idempotent sync prevents duplicate customers or orders being created

PUT-based operations mean re-triggering the sync updates existing records instead of creating new ones — safe to run more than once without consequences.

Live

Invoice records visible in Salesforce as soon as MYOB confirms the order

The feedback loop closes immediately — the sales team doesn't need to log into MYOB to check whether an invoice has been raised.

Full Log

Every sync attempt tracked with status and error detail on the Opportunity record

Success or failure is recorded in structured fields, making troubleshooting fast and giving the operations team an audit trail for every Australian order.

Scalable

Architecture designed to handle growing Australian order volume without rework

Salesperson UID caching, idempotent operations, and separated API and orchestration classes mean the integration scales cleanly as transaction volume increases.

Running a Similar Salesforce + Accounting Integration Challenge?

We'll review your current Salesforce-to-accounting data flow, identify where manual steps are slowing your team down, and outline the integration architecture. Free audit — findings delivered in 5 business days, no commitment required. We cover US EST, UK GMT, and AEST time zones.


Technologies Used

The Tools and Techniques Behind This Engagement

Salesforce Sales Cloud Salesforce CPQ (Steelbrick) MYOB Advance MYOB Advance REST API Apex Classes (MYOBAdvanceAPI) Apex Orchestrator (MyobAdvanceSingleOppSyncOrder) JSON-to-Apex Data Structures Custom Settings (API Credentials + Tokens) Named Credentials OAuth 2.0 Token Auth Access Token + Refresh Token Management HTTP Named Credential Endpoint Opportunity (MYOB_Advance_Sync_Status__c) Account (MYOB_Advance_Account_UID__c) Invoice__c SBQQ__Quote__c + Line Items

Your team shouldn't be typing the same data twice

Twopir has connected Salesforce to accounting, ERP, and inventory systems for 500+ clients across the US, UK, Australia, and UAE over 12+ years — building integrations that are robust, secure, and built to scale with your business.

12+ Years · 500+ Clients · Salesforce Partner ·
Integrations: US · UK · Australia · UAE · Canada