Xero Grid Integration

The Xero Grid integration connects Salesforce to Xero Accounting, allowing teams to view, search, and export live accounting records (Invoices, Bills, Contacts, Accounts, and Payments) directly inside AppColab Grid.

Xero Live Grid Preview


What’s Deployed

Component Name Purpose
Named Credential Xero Connects to https://api.xero.com via Xero External Credential
External Credential Xero OAuth 2.0 / Auth Provider authentication
Apex Client XeroClient.cls REST client supporting listInvoices, listContacts, listAccounts, listPayments, getConnections
Apex Data Provider XeroGridDataProvider.cls Implements appcg.GridDataProviderV1 with server-side pagination and multi-resource support
Permission Set Integration_Admin Grants access to Xero external credential principal

One-Time Manual Setup

1. Register App in Xero Developer Portal

  1. Log into the Xero Developer Portal and click New App.
  2. Set:
    • App type: Web app
    • App name: AppColab Grid
    • Company or application URL: https://appcolab.com
    • Redirect URI: Paste your Salesforce OAuth Callback URL from your Xero_OAuth Auth Provider in Salesforce Setup.
  3. Click Create app and copy your Client ID and Client Secret.

Xero Developer App Setup


2. Configure Credentials in Salesforce Setup

2.1 Create the Auth. Provider

  1. In Salesforce Setup, enter Auth. Providers in the Quick Find box and click New:
    • Provider Type: OpenIdConnect
    • Name: Xero_OAuth
    • URL Suffix: Xero_OAuth
    • Consumer Key: Paste your Xero Client ID from Step 1.
    • Consumer Secret: Paste your Xero Client Secret from Step 1.
    • Default Scopes: openid profile email accounting.transactions accounting.contacts accounting.settings offline_access
    • Click Save.
  2. Copy the Callback URL displayed at the bottom of the page and paste it into your Xero App’s Redirect URIs in the Xero Developer Portal.

2.2 Create the External Credential

  1. In Salesforce Setup, enter Named Credentials in Quick Find.
  2. Click the External Credentials tab → click New:
    • Label: Xero
    • Name: Xero
    • Authentication Protocol: OAuth 2.0
    • Authentication Provider: Select Xero_OAuth
    • Scope: openid profile email offline_access accounting.invoices accounting.contacts accounting.settings
    • Click Save.
  3. In the Principals section, click New:
    • Parameter Name: ApiKey
    • Sequence Number: 1
    • Identity Type: Named Principal
    • Scope: openid profile email offline_access accounting.invoices accounting.contacts accounting.settings
    • Click Save.
  4. On the ApiKey row, click the dropdown arrow → click Authenticate.
  5. Log into Xero, select your Organization, and approve the connection. (Status will update to Configured).

Xero External Credential Setup

2.3 Create the Named Credential

  1. Click the Named Credentials tab (next to External Credentials) → click New:
    • Label: Xero
    • Name: Xero
    • URL: https://api.xero.com
    • External Credential: Select Xero
    • Generate Authorization Header: Checked
    • Allow Formulas in HTTP Header: Checked
  2. Click Save.

Xero Named Credential Setup


3. Assign Permission Set Access

  1. In Salesforce Setup, enter Permission Sets in Quick Find.
  2. Select Integration Admin (or Appcolab Grid Admin).
  3. Click External Credential Principal Access → click Edit.
  4. Add Xero - ApiKey to Enabled External Credential Principals.
  5. Click Save and verify the permission set is assigned to your Salesforce users.

Creating a Xero Grid Definition

  1. In Salesforce, open AppColab Grid app → Grid Definitions tab → click New Grid Definition.
  2. Fill in:
    • Grid Settings Name: Xero_Invoices_Grid
    • Grid Label: Xero Invoices
    • Is Active?: Checked
    • Data Provider Class: XeroGridDataProvider
    • Data Provider Configuration:
      {
        "tenantId": "YOUR_XERO_TENANT_ID",
        "resource": "invoices"
      }
      

      How to find your Tenant ID:

      1. In the Xero Developer Portal, open your app (AppColab Integration).
      2. On the left sidebar menu, click Connection management.
      3. Find your connected organization in the table and copy the Tenant ID UUID (e.g. 83d44152-5f32-405b-a449-41b1c4f59590).

      Tip: Set "resource" to "contacts", "accounts", "bills", or "payments" to display other financial records.

  3. Click Save & Next → proceed to Preview.
  4. Real-time invoices render with Invoice Number, Contact Name, Date, Due Date, Total, Amount Due, Status, and Currency!

Xero Grid Definition


Supported Grid Features

Resource Supported Columns
Invoices Invoice Number, Reference, Contact Name, Date, Due Date, Total, Amount Due, Amount Paid, Status, Currency
Contacts Name, First Name, Last Name, Email, Phone, Contact Status, Is Customer?, Is Supplier?
Accounts Code, Account Name, Type, Class, Tax Type, Description, Status, Payments Enabled
Payments Date, Invoice Number, Account, Account Code, Amount, Reference, Status

Troubleshooting

  • 401 Unauthorized / Token Expired: Re-authenticate the Xero_User principal in Salesforce Setup → Named Credentials → External Credentials → Xero.
  • 400 Bad Request / Tenant ID missing or invalid: Make sure your "tenantId" in the Data Provider Configuration JSON is the UUID of your active connected Xero organization.