# Record matching

<figure><img src="https://2481481593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtLaMDbvbGOow76E8CnqW%2Fuploads%2FKcqxscGMQHp594DLrIAk%2Frecord%20matching.gif?alt=media&#x26;token=e7fb3434-5087-4a0d-854e-da26e2aa1ff6" alt=""><figcaption><p>Using record matching to match contacts on the account name field across Salesforce and Airtable</p></figcaption></figure>

### About record matching

Before turning on sync, you may already have data in both of your apps. For example, if syncing Salesforce and Postgres, you may might have contact records in each:

<figure><img src="https://2481481593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtLaMDbvbGOow76E8CnqW%2Fuploads%2FjvuTXN92uVODPW5JO8kT%2Fcontacts%20data.png?alt=media&#x26;token=0194252b-13ae-49b2-94f3-15fa76b4947b" alt=""><figcaption><p>Example where record matching will be helpful since data already exists in both apps</p></figcaption></figure>

With record matching, you can tell Whalesync how to match and merge these records when you turn on sync for the first time.

In this example, we might match on the `email` field since that field is unique for each record.

{% hint style="info" %}
Note - record matching only runs during the initial sync to match records that existed prior to activating your sync.
{% endhint %}

### Overwrite conflicting fields

Sometimes matched records do not have the exact same data in every field. In these cases, you can choose which app's data should take precedence.

<figure><img src="https://2481481593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtLaMDbvbGOow76E8CnqW%2Fuploads%2F2fiFLvGCL7p12mDkfizj%2Frecrod%20matching%20-%20overwrite.png?alt=media&#x26;token=cba3f752-db65-480c-acc5-f485baf8960a" alt=""><figcaption><p>Here the user has chosen to treat Salesforce as the source of truth for conflicting values in matched records</p></figcaption></figure>

### Advanced settings

We strongly suggest matching with unique fields (like IDs) wherever possible. If you match on a non-unique, Whalesync will alert you to any records that cannot be matched because they are not unique.

<figure><img src="https://2481481593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtLaMDbvbGOow76E8CnqW%2Fuploads%2FJ0E2ciEcIVrSHnZohAFw%2Frecord%20matching%20advanced%20record%20matching.png?alt=media&#x26;token=e69b6910-406c-490c-a7a2-c5212a885df9" alt=""><figcaption><p>Example where two records in Airtable have the same value in the "Email" field so they cannot be matched</p></figcaption></figure>

In these cases you can optionally add a second matching column. This tells Whalesync to first try to match records on the first column, then try to match records on the second column.

Alternatively, you can move past this screen even if you have non-unique values but be aware that those records will not be able to be matched which can result in unwanted duplicates.
