Automated Salesforce Opportunity to Xero Multi-Line Invoicing (Make.com)

Streamline Lead-to-Cash by synchronizing Salesforce Closed-Won Opportunities with Xero Invoices using Make.com's advanced line-item processing.

Tools: SalesforceXero

Platform: Make.com

Short Answer

A fully automated workflow that triggers upon a 'Closed-Won' status in Salesforce, pulls all associated line items, searches for or creates the Xero Contact, and generates a detailed Draft Invoice ready for review.

The Problem

Manual entry of Salesforce Opportunity data into Xero causes billing delays, human error in line-item pricing, and data silos between Sales and Finance teams. Standard integrations often struggle to map multiple products from a single deal into a structured accounting format.

The Outcome

A fully automated workflow that triggers upon a 'Closed-Won' status in Salesforce, pulls all associated line items, searches for or creates the Xero Contact, and generates a detailed Draft Invoice ready for review.

Step-by-Step Guide

1. **Create the Scenario**: Log into Make.com, click 'Create a new scenario', and name it 'Salesforce to Xero: Opportunity Invoicing'. 2. **Salesforce Trigger**: Add the 'Salesforce > Watch Records' module. Set the 'Object' to 'Opportunity'. Use a filter in the module settings or a Make filter to only process records where 'Stage Name' = 'Closed Won'. 3. **Identify/Create Contact**: Add a 'Xero > Search for Contact' module. Map the Salesforce 'Account Name' to the Xero 'Name'. Add a Router: if no contact is found ($body.length = 0), use the 'Xero > Create a Contact' module; otherwise, proceed to the next step. 4. **Get Line Items**: Add a 'Salesforce > List Opportunity Products' module. Pass the 'Opportunity ID' from the trigger to fetch all associated SKUs, quantities, and prices. 5. **Process Line Items (Iterator)**: Add an 'Iterator' module. Map the 'Array' of products from the previous Salesforce step. This breaks the product list into individual bundles. 6. **Build the Xero Array (Aggregator)**: Add an 'Array Aggregator' module after the Iterator. Set the 'Source Module' as the Iterator and the 'Target Structure' as the 'Line Items' field for a Xero Invoice. Map Product Code, Quantity, and Unit Price. 7. **Generate Invoice**: Add the 'Xero > Create an Invoice' module. Map the 'Contact ID' from Step 3 and the 'Line Items' array from Step 6. Set 'Status' to 'DRAFT' to allow for final Finance approval. 8. **Add Error Handling**: Right-click the Xero module and select 'Add error handler'. Use a 'Break' or 'Rollback' directive to ensure that failed invoice creations are logged and the operation is retried or paused to prevent duplicate data.