Recipe #16: Automatic Invoices with Salesforce to Xero

There are 16 days until the close of 2015 and the beginning of 2016 and it’s been an amazing year here at Workato. In honor of the impending new year, we’re counting down the most popular recipes ending on January 1st, 2016!

Our first recipe connects Salesforce and Xero and automatically creates a new invoice in Xero with duplicate eliminating logic. When an opportunity stage is updated in Salesforce with the stage ‘Closed Won’ Workato will perform several steps to avoid duplicates and intuitively create an invoice.

Screen Shot 2015-12-17 at 6.35.24 PM

To avoid duplication (when an opportunity with the stage ‘Closed Won’ is updated multiple times), we update the Salesforce opportunity description field with the Xero invoice number and ID, and every time a trigger event comes in, we check to see if its description field contains the word ‘Xero’. If it does, it implies the opportunity already has a corresponding Xero invoice created, and we end the recipe.

If the description does not contain the word ‘Xero’, the recipe will check to see whether a customer exists in Xero with either a display name or a company name that corresponds to the Salesforce account name. If such a Xero customer exist, Workato will jump to Step 8 and create a Xero invoice. If such a customer does not exist, Workato will create the Xero customer first before creating a Xero invoice.

New changes to the Salesforce opportunity made after the creation of the Xero invoice will not be synced over to Xero again. To complete the workflow use in tandem with this recipe.

Stay tuned for our next recipe tomorrow!

Want to start automating your invoices? View this recipe >>