Sync Salesforce opportunities to Xero invoices
CRMMarketingRecipe ToolsDeveloper ToolData Parser
What it does
When someone schedules a payment terms search in Salesforce, this automation finds closed opportunities. It creates a Xero invoice with a line item for each one, checking billing cycle and date fields first so incomplete records are skipped.
Who it's for
Accounting teams who need to bill closed deals from Salesforce without manually entering them into Xero.
How teams use this
Bill closed deals automatically
Run the scheduled search to find all Closed Won opportunities with complete billing dates, then create Xero invoices in one batch. The team no longer enters these invoices by hand.
Sync only specific opportunity types
Retarget the search to filter by opportunity record type or product family so only certain deals flow to Xero. The rest stay in Salesforce until they meet the criteria.
Add custom fields to the invoice line
Include project code, cost center, or department from the opportunity so each Xero line item is tagged for accounting. Set a lookup table to map Salesforce values to Xero codes.
Notify when invoices are created
Add a notification step to alert the billing team in Slack or email when invoices are created, including the opportunity name and amount. Only high-value deals or specific stages trigger the notification.
How it works
- Search Salesforce for payment terms. Run a scheduled search in Salesforce to find opportunities with payment terms set using a query where clause.
- Filter for closed opportunities. Search Salesforce for opportunities where the stage equals Closed Won and billing cycle, start date, and end date are all present.
- Check billing dates are complete. For each opportunity found, verify that billing cycle, billing start date, and billing end date fields all have values before proceeding.
- Create Xero invoice per opportunity. For each qualifying opportunity, create an invoice in Xero with a single line item using the opportunity amount and billing dates from Salesforce.
- Monitor for errors. Watch the invoice creation steps for failures so incomplete or duplicate invoices are caught and logged for review.