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 also creates the contact and items in Xero if they do not already exist.
Who it's for
Accounting teams who need invoices in Xero generated automatically when deals close in Salesforce.
Apps used
How teams use this
Automate invoice creation on deal close
When a deal closes in Salesforce, the invoice appears in Xero with all line items ready. No manual data entry is needed between the two systems.
Sync new contacts to Xero automatically
If the customer contact does not exist in Xero, this automation creates it from Salesforce account and contact data before the invoice is generated.
Prevent duplicate invoices with stored reference
The Xero invoice number is stored in the Salesforce Next Step field so the automation only creates one invoice per opportunity, even if the record is updated again.
Extend to include custom product mapping
Add a lookup table to map Salesforce product IDs to Xero item codes so products sync with the correct accounting classification and pricing.
How it works
- Opportunity reaches Closed-Won stage. A Salesforce opportunity is updated to Closed-Won and has a Portal Start Date. The Next Step field stores the Xero invoice number to prevent duplicate invoices.
- Retrieve account and contact details. Look up the associated Salesforce account and billing contact for the opportunity so their information can be sent to Xero.
- Check for existing contact in Xero. Search Xero for a contact matching the Salesforce account. If not found, create the contact in Xero using the account and contact information from Salesforce.
- Match and create invoice line items. Search Xero for items matching the opportunity products. Create any missing items, then create the invoice in Xero with all products as line items.
- Store the invoice number. Write the Xero invoice number to the Next Step field in Salesforce so the same invoice is not created twice.