The Xero connection and cached data
How Smartworks signs in to Xero, which Xero data it keeps a copy of, and for how long.
Smartworks talks to Xero through a connection an admin makes once. Your customers, suppliers, products and Xero settings are copied into Smartworks’ memory so screens open quickly. Each copy is refreshed from Xero after a set time, or straight away when you click Update in Xero Data Sets. Documents are not cached: they are read from Xero each time.
The connection
An admin connects Smartworks with Connect To Xero, signs in on Xero’s own site and allows access. Xero gives Smartworks a connection, not your Xero username or password. The steps are in Connect Smartworks to Xero.
Smartworks renews the connection with Xero on its own, whenever it needs to talk to Xero. Last Refreshed Auth on the Xero Connector page shows when it last did. Xero lets a connection go unrenewed for 60 days at most. After that, Smartworks shows Xero Authentication expired. Please authenticate again to continue. and an admin connects again.
Disconnect removes every Xero connection Smartworks holds for your account, and clears the cached data. The Xero Connector table is read from Xero each time you open the page.
What is cached, and for how long
| Data set in Xero Data Sets | Kept for | How it reloads |
|---|---|---|
| Customers & Suppliers | 2 hours | Only the contacts changed in Xero since the last load |
| Products | 2 days | The whole list |
| Tax Rates | 2 days | The whole list |
| Tracking Categories | 2 days | The whole list |
| Chart of Accounts | 2 days | The whole list |
| Branding Themes | 2 days | The whole list |
When a set is past its time, the next screen that needs it is shown the copy Smartworks already has. Smartworks then reloads the set from Xero in the background, ready for the screen after. So a change made in Xero can take one more page load to appear, even once the time is up.
If Xero cannot be reached, Smartworks keeps using the copy it has.
Customers reload with only what changed
Customers and suppliers reload often because a reload is small. Smartworks asks Xero only for the contacts changed since the last load, with five minutes of overlap so nothing is missed. Contacts archived in Xero drop out, and a contact restored from the archive comes back. After you create a customer in Smartworks, it also picks up any other contact changes in the background.
After a restart
The cache lives in memory, so it starts empty when Smartworks is updated or restarted. The first screen to need a set then waits while Smartworks loads all of it from Xero. Xero Data Sets shows Last Updated: Not loaded yet for a set that has not loaded since.
Single items not in the copy
If a screen asks for one customer or product that the copy does not have yet, such as one just added in Xero, Smartworks fetches that one from Xero and adds it to the copy.
Update a data set now
The Xero Data Sets dialog on the Xero Connector page lists each set with Last Updated and when it next updates in the background.
Step by step: update a data set from Xero
- Click Settings in the header.
- Click Xero Connector under Connectors.
- Click Xero Data Sets.
- Click Update beside the set you changed in Xero.
- Click Close.
Smartworks loads the whole set from Xero and shows that it was updated. If Xero cannot be reached, it says so and keeps the copy it had.
Each set can be updated from here once every 5 minutes. The wait counts from the last request, even if that one failed. Until then the Update button is greyed out, and the dialog says when you can update again.
Limitations
- A change made in Xero shows in Smartworks only after that set next reloads: up to 2 hours for customers and suppliers, and up to 2 days for the other sets. Click Update to see it sooner.
- Update refreshes Smartworks’ copy. Product pickers in a browser or on a phone keep their own copy of the product list for up to a day, and Update does not refresh those.
- After an update or restart, the first screen to need each set waits for a full load from Xero.
- A full load of customers and suppliers reads at most 10,000 contacts from Xero.
- If the connection goes 60 days without being renewed, an admin has to connect again.
See also
- The Xero Connector - the screen with the connection table and Xero Data Sets.
- Connect Smartworks to Xero - make or remake the connection.
- Customers and suppliers - the data set that reloads most often.
- Known limitations - all the limitations in this guide.