Duplicate Entries
Troubleshooting and preventing duplicate entries in Xero.
Why Duplicates Occur
After Reset Sync State
The most common cause. When you reset sync state:
- All Blesta-to-Xero mappings are deleted
- Plugin no longer knows what was synced
- Next sync creates new entries in Xero
- Original Xero entries remain
After Plugin Reinstall
Similar to reset - mappings are lost and recreated.
Manual Xero Entry + Sync
If you manually create an entry in Xero, then sync creates another.
Preventing Duplicates
Before Bulk Sync
- Check Xero for existing entries
- Use Skip Historical for old data
- Only sync new records going forward
Before Reset Sync State
Ask yourself:
- Do I really need to reset?
- Will I clean up Xero afterward?
- Can I fix the issue another way?
Sync Recovery Feature
The plugin attempts to match existing Xero entries:
- Searches for contacts by email
- Searches for invoices by number
- Links if found instead of creating duplicate
This helps after reinstall but isn't perfect.
Fixing Duplicate Contacts
In Xero
- Go to Contacts in Xero
- Find duplicate contacts
- Use Xero's Merge contacts feature
- Keep the contact linked to Blesta
Update Mapping (Advanced)
If wrong contact is mapped:
- Note the correct Xero contact ID
- Access database
- Update
xero_sync_mappings table
- Set correct
xero_id for the contact
Fixing Duplicate Invoices
Cannot Merge in Xero
Xero doesn't have invoice merge functionality.
Option 1: Delete in Xero
- If invoice is DRAFT, delete it
- If AUTHORISED, void it
- Keep the one linked to Blesta payments
Option 2: Delete in Blesta
If the Blesta invoice is the duplicate:
- Void in Blesta
- This will void in Xero (if synced)
- Keep manual Xero entry
Option 3: Update Mapping (Advanced)
- Identify correct Xero invoice
- Update mapping in database
- Future syncs will update correct invoice
Fixing Duplicate Payments
Duplicate Creates Overpayment
If duplicate payment exists:
- Client shows overpaid in Xero
- Delete or void the duplicate
- Reconcile bank feed
Both Payments Valid
If both are legitimate:
- Keep both
- Update mapping if needed
- Ensure no bank reconciliation issues
Database Cleanup (Advanced)
View Current Mappings
SELECT * FROM xero_sync_mappings
WHERE company_id = YOUR_COMPANY_ID
AND entity_type = 'contact';
Remove Duplicate Mapping
DELETE FROM xero_sync_mappings
WHERE id = MAPPING_ID;
Update Mapping
UPDATE xero_sync_mappings
SET xero_id = 'NEW_XERO_ID'
WHERE id = MAPPING_ID;
Warning: Always backup before database changes.
Best Practices
Regular Monitoring
- Check Xero periodically for duplicates
- Review sync logs for patterns
- Address issues early
Careful with Reset
- Only reset when absolutely necessary
- Document what exists in Xero first
- Plan cleanup afterward
Use Skip Historical
- For new installations with existing data
- Prevents syncing years of history
- Start fresh from a specific date