Three Ways to Connect Salesforce with Xero

Want to see up-to-date invoices, bills, payments, and other accounting information directly within Salesforce? Sick of manually copy-and-pasting sale and product details from Salesforce to Xero? In this blog post, we’ll discuss three ways to connect these two apps:

  1. Zapier
  2. Breadwinner
  3. Custom development

If you’re looking to increase visibility into financial info within Salesforce, eliminate errors in Xero invoice creation, or just save time and effort jumping between the two systems, read on!

Zapier

The first option we’ll discuss is Zapier, a popular general integration and automation platform. Zapier can connect Salesforce and Xero (along with a huge variety of other apps) without writing a line of code, and instead via an intuitive and easy-to-learn interface which will have you moving data from Salesforce to Xero in no time. Zapier is also highly customizable — it will work just fine with custom objects or fields, and can move data between the two systems in whichever specific way your business requires.

However, since Zapier isn’t specifically built to handle financial information, you’ll need to be extra careful while configuring and testing your integration. Zapier won’t prevent you from overwriting or erasing information in Xero, even after an invoice has been raised — it doesn’t have any built in safeguards or limitations, and you will need to ensure the integration you configure will protect your financial data (in particular for auditing purposes).

Also, be aware that while Zapier provides some templates for common integration requirements, it doesn’t provide a truly out-of-the-box solution for connecting Salesforce and Xero. Be prepared to spend some time getting things set up. For example, if you want to see Invoices and Line Items in Salesforce, you’ll first need to create and configure custom objects to store all the data you want to see.

Key benefit: simple user interface, flexible

Drawback: few security measures, careful configuration required

https://zapier.com/

Breadwinner

Our second option is Breadwinner, a Salesforce-native application that focuses exclusively on integrating Salesforce and financial systems like Xero (along with QBO and Netsuite). Breadwinner provides an even easier set-up than Zapier. Just install the package from the AppExchange, connect it to Xero, match your Xero Companies to your Salesforce Accounts, and you’ll be up and running — in hours, not days or weeks. Out of the box, Breadwinner will sync your historical Invoices and allow you to create Invoices from Opportunities without any configuration required, all though a clean and straightforward user interface.

Breadwinner also has strong protection for your financial information; you won’t have to worry about existing Invoices being accidentally edited or deleted from within Salesforce. And while Breadwinner is less openly customizable than Zapier, it still works perfectly with custom objects and fields, allowing fine-grained control over the data you push into Xero.

The downside of Breadwinner’s easy set-up and pre-configured process is that if you have especially complex or unusual integration requirements, Breadwinner might not suit: for example, if you want to store your Invoice data on a custom object you’ve already created. But if you simply want to see and create Invoices (as well as Bills and POs) from within Salesforce, give Breadwinner a go: the basic version of the application is totally free, so you can try it out without any real commitment or risk.

Key benefit: fast set-up, easy configuration

Drawback: less flexible for unusual requirements

https://breadwinner.com/

Custom development

The last option we’ll discuss is building your own connection between Salesforce and Xero by making use of Apex and the APIs of these two platforms. The benefit of this approach is that it’s extremely configurable: you’re writing the code, and you can build the integration however you’d like.

The downside, of course, is that you have to write the code in the first place! Connecting Salesforce and any financial application containing sensitive data is certainly not simple, and will require a substantial investment in planning, coding, and thorough testing. For a little insight, here’s a snippet of Apex which will create a draft Invoice in Xero:

public class Xero{
    public void createDraftInvoice() {
        try{
            XeroAuthorization(); //Which must be configured with Xero OAuth

            String requestBody = getInvoiceXml();
            String Endpoint = 'https://api.xero.com/api.xro/2.0/Invoices';

            HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setTimeout(120000);
            req.setHeader('Content-Type','text/xml');
            req.setHeader('Accept', 'application/json');
            req.setEndpoint(Endpoint);
            req.setBody(requestBody);

            Http http = new Http();        
            HttpResponse res =  http.send(req);
            if(res.getStatusCode() == 200){
                // Create a record in SF
            }else{
                System.debug('There was a problem while creating the Invoice :: '+res.getStatusCode());
            }
        } catch(Exception e){
            System.debug('Exception '+e);
        }        
    }
    public String getInvoiceXml(){
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartElement('', 'Invoices', '');
        w.writeStartElement('', 'Invoice', '');

        w.writeStartElement('', 'Type', '');
            w.writeCharacters('ACCREC');
        w.writeEndElement();

        w.writeStartElement('', 'Contact', '');
            w.writeStartElement('', 'Name', '');
            w.writeCharacters('Martin Hudson');
            w.writeEndElement();
        w.writeEndElement();

        w.writeStartElement('', 'Date', '');
            w.writeCharacters('2020-08-12T00:00:00');
        w.writeEndElement();

        w.writeStartElement('', 'LineAmountTypes', '');
            w.writeCharacters('Exclusive');
        w.writeEndElement();

        w.writeStartElement('', 'LineItems', '');
        w.writeStartElement('', 'LineItem', '');

        w.writeStartElement('', 'Description', '');
            w.writeCharacters('Example description text');
        w.writeEndElement();

        w.writeStartElement('', 'Quantity', '');
            w.writeCharacters('4.3400');
        w.writeEndElement();
        
        w.writeStartElement('', 'UnitAmount', '');
            w.writeCharacters('395.00');
        w.writeEndElement();

        w.writeEndElement();//end LineItem
        w.writeEndElement();//end LineItems

        w.writeEndElement();//end Invoice
        w.writeEndElement();//end Invoices

        String xmlOutput = w.getXmlString();
        w.close();
        return xmlOutput;
    }
}

Of course, much more than this will be required to build out a robust integration!

While this custom approach means that you won’t have to pay any subscription fees, do keep in mind that you’ll need to commit to maintaining the integration with your own development resources, especially given that Salesforce and Xero are both updated very frequently. But if you want to maintain complete control over your connection, or your requirements are too specific for either Breadwinner or Zapier, writing custom code might be the way to go. 

Key benefit: completely customizable, no subscription costs

Drawbacks: very technically demanding, ongoing maintenance

Conclusion

Connecting Salesforce to Xero can save you time, annoying manual effort, and therefore money. We hope that this article has helped inform you about a few of the different ways to connect Salesforce and Xero.

Speak Your Mind

*