Sync Salesforce custom invoices to Xero

CRMMarketingSalesAccounting

What it does

When someone creates an invoice in Salesforce, this automation syncs it to Xero as a new invoice. It searches for the customer contact in Xero, creates one if needed, and builds the invoice with all matching line items.

Who it's for

Accounting teams who need invoices created in Salesforce to appear in Xero without manual entry.

How teams use this

Sync invoices without manual Xero entry

Create invoices in Salesforce and have them appear in Xero with all line items and customer details already filled in. The team works in Salesforce and Xero stays in sync.

Route invoices by customer type

Extend this automation to check a customer field in Salesforce and only sync invoices for certain account types to Xero. Other invoices stay in Salesforce for review.

Flag missing customers for review

Add an email notification that alerts the team when a Salesforce invoice customer is not found in Xero. The team can then decide whether to create the contact or hold the sync.

Include Xero invoice number in Salesforce

Set the Xero invoice number back to the Salesforce invoice record after creation in Xero so both systems reference the same document number.

How it works

  1. New invoice created in Salesforce. A custom invoice object is created in Salesforce with associated account and line item details ready to sync.
  2. Retrieve account and line items. Fetch the Salesforce account details and all related invoice line items so they can be matched to Xero records.
  3. Find or create the contact in Xero. Search Xero for a contact matching the Salesforce account. If the contact does not exist, Xero creates it so the invoice has a valid customer.
  4. Create invoice and line items in Xero. Create the invoice header in Xero, then add each Salesforce line item as a corresponding line in the Xero invoice.