Create Xero invoice from Salesforce Closed-Won opportunity

CRMMarketingAccounting

What it does

When a Salesforce opportunity moves to Closed-Won, this automation creates an invoice in Xero with the opportunity products as line items. It adds the contact and items to Xero first if they do not exist, so the invoice is complete.

Who it's for

Accounting teams who need invoices in Xero to match closed deals in Salesforce without manual entry.

How teams use this

Invoice customers on closed deals

Move Closed-Won opportunities to Xero as invoices without opening Xero or re-entering customer and product data. The invoice is ready to send.

Sync invoices to a revenue system

Route Closed-Won opportunities from Salesforce to a different accounting platform by changing the target app. The same flow handles contact and item creation.

Add custom fields to the invoice

Include project code, cost center, or department from the Salesforce opportunity so the invoice carries those details into Xero. Map the fields when the invoice is created.

Filter invoices by opportunity type

Only create Xero invoices for Closed-Won opportunities that match a specific type or amount threshold. Add a condition to skip smaller or internal deals.

How it works

  1. Opportunity moves to Closed-Won. A Salesforce opportunity status changes to Closed-Won and the Xero invoice number is not yet set on that record.
  2. Search for the contact in Xero. Search Xero for a contact that matches the Salesforce account and contact so the invoice links to the right customer.
  3. Create the contact if missing. When the contact does not exist in Xero, create it from the Salesforce account and contact details so the invoice has a valid customer.
  4. Create items for opportunity products. Create line items in Xero for each product on the opportunity if they do not already exist, so the invoice reflects what was sold.
  5. Create the invoice. Create the invoice in Xero with the contact and products, then link the Xero invoice number back to the Salesforce opportunity record.