Duplicate Emails Synced from On-Premise Exchange to Salesforce

Grace Wannapongsai
Grace Wannapongsai
  • Updated

Issue

The same email may sync multiple times from On-Premise Exchange to Salesforce, creating duplicate EmailMessage records.

Riva successfully creates the email in Salesforce, but post-processing fails when Riva cannot retrieve the newly created EmailMessage by its ID. Logs may contain the following message:

get EmailMessage by ID returned 0 rows

Cause

A post-processing failure after an EmailMessage creation can cause Riva to sync the same email again, resulting in duplicate records.

In the investigated case, missing attachment size information in the email body also contributed to failures in downstream Salesforce logic. The attachment size was not being appended when Riva used Exchange 2016 service behaviour.

Resolution

The issue was resolved by upgrading Riva and applying an advanced option to the affected On-Premise Exchange connection.

1. Confirm the Duplicate Sync Behaviour

Review the Riva logs to confirm repeated email syncing and duplicate record creation. Check whether the EmailMessageis created successfully in Salesforce but retrieval by ID returns zero rows.

2. Apply Temporary Containment Keys

Applied temporary containment keys to stop continued duplicate creation:

Sync.Ex.SyncStartTimeOverride.Email = <containment_date>
Sync.Ex.MinCreateDate.Email = <containment_date>

Replace <containment_date> with the appropriate date in YYYY-MM-DD format, for example, 2026-09-15.

3. Test the Riva Upgrade in UAT

Upgrade the user acceptance testing (UAT) environment to Riva version 2026.2.108.5200 or later. This version includes a fix for duplicate email syncing caused by a post-processing failure after EmailMessage creation.

Test email syncing and check whether retrieval of the newly created EmailMessage still returns zero rows.

4. Check Attachment Size Information

Identified that attachment size was not being appended when using Exchange 2016 behaviour.

5. Add the Exchange Connection Setting in UAT

Add the following advanced option to the affected On-Premise Exchange connection in UAT:

Sync.Ex.Use2010ServiceAsDefault = True

This setting forces Exchange 2010 service behaviour. Add it only to On-Premise Exchange connections, not Microsoft 365 or Microsoft Graph connections.

6. Verify the Results in UAT

Confirm that:

  • Attachment size information appears correctly in the email body.
  • Emails sync successfully without the post-processing failure.
  • The same email is no longer repeatedly created in Salesforce.

7. Apply the Tested Changes to Production

Deploy the tested Riva upgrade and add the same advanced option to the affected On-Premise Exchange connection in production. Apply the setting to any other affected On-Premise Exchange connections as needed.

8. Confirm the Issue Is Resolved

Monitor email syncing in production and confirm that the post-processing failure and duplicate creation no longer occur.