Power Automate & Xero | Dynamics 365 Documentation | Magnetism

Dynamics 365 is Better with Infinity Buttons. Try it for Free for 30 Days

Power Automate Xero Connector Documentation



Getting Started

Or get started with a 7 day free trial.

Create a Connection

Each connection is linked to a specific Xero user. A user can be authorised for multiple Xero tenants/environments. Licenses are linked to the Xero authorising user, and can be shared across organisations/environments.

Connections can be created directly from within a Cloud Flow when adding an Action or Trigger for the Xero Accounting - Magnetism connector for the first time. Alternatively, create and manage connections from the Connections area in the maker portal.

Create Connection from a Cloud Flow

  1. From any Power Automate Cloud Flow, add a new Action or Trigger and search for Xero Accounting - Magnetism.

  2. Select any of the actions, and you’ll be prompted to create a new connection. Select Sign in.

  3. You’ll be redirected to Xero to sign in and Allow access for the App to your selected Xero organisation. It’s recommended to use a generic administrative user to avoid permissions issues.

  4. Once authorised, you’ll be redirected back to your Cloud Flow and can continue using the connector.

Manage & Create Connections

  1. From the Power Apps or Power Automate maker portal, select Connections, and then New connection.

  2. Search for and select Xero Accounting - Magnetism, then Create.

  3. You’ll be redirected to Xero to sign in and approve the App for your selected Xero organisation. It’s recommended to use a generic administrative user to avoid permissions issues.

  4. Once authorised, you’ll be redirected back to the Connections list and can see the status Connected.

  5. To authorise multiple Xero tenants from the same user, either create a new connection, or select See Details from the existing connection, and Switch account to repeat steps 3-4.

The trial is valid for 7 days, after which a user license is required to continue using the connector.

Selecting the Tenant ID

Actions include dynamic content from your selected Xero Tenant ID. If transferring flows between environments where a different Xero Tenant ID is required, it’s recommended to use an Environment Variable to store the Tenant ID. This can be used with each Trigger and Action and will still allow dynamic content to populate correctly.

Find your Xero Tenant ID

Select your Tenant ID from the dropdown on any Xero Accounting - Magnetism action or trigger. Then use Code view to copy the xero-tenant-id parameter value.

Using an Environment Variable

Create an environment variable (e.g. called Xero Tenant Id) with the current value copied from above. Then reference this by selecting Enter custom value from the Tenant ID dropdown.

Xero Accounting API

The schema used by the dynamic operations are based on Xero Accounting API.

Operations

View the full Microsoft documentation.

Trigger when a Xero record is Created or Updated

Trigger when a Xero record is Created or Updated, e.g. Invoice, Contact.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Event Type (required) - The type of event to trigger on. Create, Update, or Create and Update.

Event Category (required) - The type of Xero record to trigger on. Invoice, or Contact.

Output parameters

Record ID - The ID of the Invoice or Contact.

Event Category - The category of event that occurred. INVOICE, or CONTACT.

Event Type - The type of event that occurred. CREATE, or UPDATE.

Event Date UTC - The date the event was triggered in UTC time.

Create a Xero record

Create a Xero record, e.g. Invoice, Credit Note, Contact.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Record Type (required) - The type of Xero record to create. Contact, Credit Note, Credit Note Allocation, Invoice, Item, Note, Payment (Credit Note), Payment (Invoice).

Additional fields are dynamic based on the record type.

Output parameters

Dynamic based on the record type. Includes the full Xero record.

Delete a Xero record

Delete a Xero record by its ID, e.g. Invoice, Payment, Credit Note.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Record Type (required) - The type of Xero record to delete. Account, Credit Note, Credit Note Allocation, Invoice, Item, Payment, Purchase Order, Quote, Repeating Invoice, Tax Rate.

Record ID (required) - The Xero record ID to delete.

Output parameters

None.

Get a Xero record by ID

Get a single Xero record by its ID, e.g. Invoice, Payment, Credit Note.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Record Type (required) - The type of Xero record to get the details for. Contact, Credit Note, Invoice, Invoice PDF, Invoice URL, Item, Note, Payment.

Record ID (required) - The Xero record ID to get the details for.

Output parameters

Dynamic based on the record type. Includes the full Xero record.

List Xero records

Get a list of Xero records, e.g. Invoices, Payments, Credit Notes.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Record Type (required) - The type of Xero record to get the details for. Account, Branding Theme, Contact, Credit Note, Currency, History, Invoice, Invoice, Item, Payment, Tax Rate, Tracking Category.

Where (optional) - Filter conditions (if supported), e.g.: Type == “ACCREC“.

Order (optional) - Order attribute (if supported), e.g.: UpdatedDateUTC DESC.

Top (optional) - Top count of records to return.

Additional fields for History only:

Parent Record Type (required) - The parent record type to get the history for.

Parent Record ID (required) - The parent record ID to get the history for.

Output parameters

Dynamic based on the record type. Includes a list of Xero records.

Update a Xero record

Update a Xero record by its ID, e.g. Invoice, Credit Note, Contact.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Record Type (required) - The type of Xero record to update. Contact, Invoice.

Record ID (required) - The Xero record ID to update.

Additional fields are dynamic based on the record type.

Output parameters

Dynamic based on the record type. Includes the full Xero record.

Send an HTTP request to Xero

Send an authenticated HTTP request to the Xero API. For more advanced operations.

Input parameters

Tenant ID (required) - The Xero Tenant ID to connect to. Dynamic list of authorised Xero tenants.

Method (required) - The HTTP method for the request. GET, POST, PUT, PATCH, DELETE.

API Endpoint (required) - Relative Xero Accounting API URL, e.g. /Invoices or /Invoices/{id}.

Header (optional) - Key/value pair of additional headers to add to the request.

Body (optional) - The Body (typically JSON) to send with the request.

Output parameters

Body - Response body content (typically JSON string).

Headers - Response headers.

Status code - Response HTTP status code.