Error: "An Unexpected Error Occurred" After Enabling the EmailMessage Object
Issue
After enabling the EmailMessage object in Salesforce, the following error appears in Fivetran:
An unexpected error occurred
Environment
Connector: Salesforce
Resolution
To resolve this issue, follow these steps:
- In Fivetran, go to your Salesforce connection page and click the error. The full error message appears on the right, including the URL of the failed Salesforce API call and the full SOQL query.
- Work with your Salesforce Admin to identify the field in the SOQL
SELECTstatement that caused the error. This issue most often occurs with theFromIdfield, but it can also occur withThreadIdentifier,ClientThreadIdentifier,IsClientManaged, andAttachmentIds. - As a short-term solution, go to the Schema tab of your Salesforce connection page and deselect the fields causing the error. This allows the connection to skip the problematic fields and sync the rest of your
EmailMessagedata. - Work with your Salesforce Admin to deduplicate the problematic fields. For more information, see the Salesforce Unable to query FromId in the EmailMessage Object documentation.
Cause
This issue occurs when a field in a Salesforce API SOQL call contains source-side duplicates. The FromId field is the most common cause, but ThreadIdentifier, ClientThreadIdentifier, IsClientManaged, and AttachmentIds can also trigger this error.