Sync Salesforce opportunities to Xero invoices

CRMMarketingSalesAccounting

What it does

When someone creates an opportunity in Salesforce, this automation syncs it to Xero as an invoice. The contact is created in Xero if it does not exist, and each product from the opportunity becomes an invoice line item.

Who it's for

Accounting teams who manage invoices in Xero and want opportunities from Salesforce to flow through automatically.

How teams use this

Move won deals to accounting

When a deal closes in Salesforce, sync it to Xero as an invoice so accounting can bill the customer right away. The opportunity details become the invoice without manual entry.

Sync only closed opportunities

Add a condition to check the opportunity stage before syncing, so only won deals create invoices in Xero. This prevents draft opportunities from becoming premature invoices.

Route invoices by region or product

Extend the flow to check the opportunity owner or product type and route the Xero invoice to different cost centers or departments. The sync stays the same and only the destination changes.

Include custom fields on the invoice

Add a step to map Salesforce custom fields like project code or purchase order number to the Xero invoice. This keeps all order context in one place.

How it works

  1. Opportunity is created in Salesforce. An opportunity is created in Salesforce with customer contact, products, and amounts.
  2. Search for the contact in Xero. Search Xero to check whether the customer contact already exists so a duplicate record is not created.
  3. Create the contact if missing. If the contact does not exist in Xero, create it with the name and details from the Salesforce opportunity.
  4. Create invoice with line items. Create a new invoice in Xero for the contact, then loop through each product on the opportunity and add it as a line item with price and quantity.
  5. Update the opportunity. Mark the opportunity as synced in Salesforce so the team knows the invoice was created in Xero.