What is the Contact Code that appears in Xero and how does this get populated?
The Contact Code field that appears in Xero can only be updated via the Xero API – it appears as a read only field within Xero. The Contact Code field represents the value of the ContactNumber XML element that is pushed to Xero. In the fmAccounting Link Xero file we map this to the ContactNumber field in the Contacts table when downloading from Xero, but when uploading we populate this with the ContactNumber field if it is not empty, otherwise we use thee _kp_ContactID field (Contacts primary key field). This allows you to easily map/identify the same Contact record in Xero and FileMaker.
N.B. when uploading a Contact the Xero API will match on either their Xero Contact ID (e.g. 64eedbc9-1fa0-485a-837f-705f23188162) or the ContactNumber/Contact Code. If you archive a Contact that has a Contact Code value (e.g. CT1523) and then attempt to upload another Contact with the same Contact Code you will get this error:
The contact number CT1523 is already assigned to another contact. The contact number must be unique across all contacts
The Xero CRM Integration guide has more information – remember that for Contacts in Xero the ContactID, ContactNumber and Name elements are unique identifiers, and both ContactNumber and ContactID are uniform resource identifiers.