How Xero Contact Clearing and Diagnostics Work
Source: xero_controller.rb
- "Clear contact if not found" searches Xero by the exact contact name (case-insensitive match); if no matching contact exists in Xero, the xero_id is cleared from the Workshop record, allowing it to be re-synced
- "Clear ALL non-existing" fetches the complete list of Xero contacts, then iterates through all Workshop records with xero_ids and clears any where the xero_id does not appear in the Xero contact list
- These are one-way operations — they only clear the link from Workshop to Xero, they do not delete anything in Xero
Support scenarios
- "Customer keeps failing to sync and shows a Xero error" → The xero_id may point to a deleted or merged contact in Xero. Use "Clear contact if not found" to remove the stale link, then re-sync to create a fresh link.
- "We have lots of contacts with broken Xero links after a Xero data cleanup" → Use "Clear ALL non-existing" to bulk-clear stale xero_ids. This fetches all Xero contacts and removes links for any that no longer exist. Be aware this can be slow for large contact lists.