XERO Xero Support

From Data Islands
Revision as of 13:29, 19 January 2023 by WikiSysopdi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

You can connect to multiple XERO accounts using the syntax

>AddServer XERO "alias"

EG

>AddServer XERO "ACMEInc"

---

We use the XERO api

https://developer.xero.com/documentation/api/accounting/overview

So for the most up to date info on fields etc please refer to this.

---

HOW TO BUILD A WHERE CLAUSE

Ref:

https://developer.xero.com/documentation/api/accounting/invoices#optimised-use-of-the-where-filter

--- Note:

The xero "invoices" table holds both invoices sent and received.

So you should filter this on the "Type" column which contains 1 of 2 values

  1. ACCREC
  2. ACCPAY


ACCREC is invoices you send and ACCPAY is invoices you pay

ref: https://developer.xero.com/documentation/api/accounting/types#invoices


>querydb invoices Date >= DateTime(2022, 01, 01) AND Date <= DateTime(2022, 01, 31) and Type=="ACCPAY"


Full XERO EXAMPLE SCRIPT


connect DATAISLANDUSERNAME DATAISLANDUSERNAMEPASSWORD

notifyme "script xero push starting" "...."

addregion tsxerodata

addserver xero

jscript "var today = new Date(); var myDate = new Date(); myDate.setDate(myDate.getDate() - 5); var somestring = 'UpdatedDateUTC >= DateTime(' + myDate.getFullYear() + ', ' + (myDate.getMonth() + 1) + ',' + myDate.getDate() + ') AND UpdatedDateUTC <= DateTime(' + today.getFullYear() + ',' + (today.getMonth() + 1) + ', ' + today.getDate() + ')'; return somestring;"

querydb contacts jscriptoutput

push contacts u "ContactID" "XERO Contacts"

jscript "var today = new Date(); var myDate = new Date(); myDate.setDate(myDate.getDate() - 50); var somestring = 'UpdatedDateUTC >= DateTime(' + myDate.getFullYear() + ', ' + (myDate.getMonth() + 1) + ',' + myDate.getDate() + ') AND UpdatedDateUTC <= DateTime(' + today.getFullYear() + ',' + (today.getMonth() + 1) + ', ' + today.getDate() + ')'; return somestring;"

querydb repeatinginvoices jscriptoutput

push repeatinginvoices u "RepeatingInvoiceID" "XERO Repeating Invoices"

jscript "var today = new Date(); var myDate = new Date(); myDate.setDate(myDate.getDate() - 5); var somestring = 'UpdatedDateUTC >= DateTime(' + myDate.getFullYear() + ', ' + (myDate.getMonth() + 1) + ',' + myDate.getDate() + ') AND UpdatedDateUTC <= DateTime(' + today.getFullYear() + ',' + (today.getMonth() + 1) + ', ' + today.getDate() + ')'; return somestring;"

querydb invoices jscriptoutput

push invoices u "InvoiceID" "XERO Invoices"

notifyme "script xero push finished {0}" "Job Status: {0}"

exit